Previous Page | Next Page

SAS Component Language Dictionary

FORMAT



Verifies that the specified format is valid
Category: Formatting

Syntax
Details
Examples
Example 1: Verifying the Validity of a Character Format
Example 2: Verifying the Validity of a Numeric Format
See Also

Syntax

rc=FORMAT(format,type);

rc

contains the return code for the operation:

1

successful

0

not successful

Type: Numeric

format

contains a format that is either supplied by SAS or created using the FORMAT procedure. The format name must contain a period (for example, dollar6. or dollar8.2).

Type: Character

type

specifies the type of the format:

'C'

character

'N'

numeric.

Type: Character


Details

If the specified format is not known to the SAS session, then the operation is unsuccessful. The function verifies that valid widths are specified for formats.

See SAS Language Reference: Dictionary for details about formats.


Examples


Example 1: Verifying the Validity of a Character Format

Assume that you want to use the $CHAR12. format and to verify that $CHAR12. is a valid character format. (If the format name is valid, then the value returned to the variable RC is 1.)

rc=format('$char12.','c');


Example 2: Verifying the Validity of a Numeric Format

Verify that 5.6 is not a valid format for numeric values. (If it is not valid, then the value returned to the variable RC is 0.)

rc=format('5.6','n');


See Also

INFORMAT

Previous Page | Next Page | Top of Page