Previous Page | Next Page

SAS Component Language Dictionary

OPTGETC and OPTGETN



Return the current setting of a SAS system option
Category: SAS System Option

Syntax
Details
Examples
Example 1: Using the OPTGETC Function
Example 2: Using the OPTGETN Function
See Also

Syntax

cval=OPTGETC(option-name);
nval=OPTGETN(option-name);

cval

contains the setting of the SAS system option returned by OPTGETC, or a blank if option-name is invalid. If cval is blank, use the SYSMSG function to check the message that SCL returned. If the message is blank, then the value of the option is blank; otherwise, option-name is invalid.

Type: Character

nval

contains the setting of the SAS system option returned by OPTGETN, or a missing value if option-name is invalid. For options with binary settings of ON or OFF, the function returns 1 if the setting is on, and 0 if the setting is off.

Type: Numeric

option-name

is the name of the SAS system option to retrieve.

Type: Character


Details

If you try to use OPTGETC to get information about a numeric option or OPTGETN to get information about a character option, an error message is generated. To determine whether a SAS system option has a numeric or character setting, see the SAS documentation for your operating environment or SAS Language Reference: Dictionary.

For options that have ON/OFF settings (for example, DATE/NODATE), use OPTGETN, because these options have the numeric value 1 for ON and 0 for OFF.

You can view current option settings by using the OPTIONS procedure in the SAS session or by using the OPTIONS command.


Examples


Example 1: Using the OPTGETC Function

Check to see whether new SAS tables will be compressed:

if optgetc('compress')='YES' then
    _msg_='Observations are compressed.';
else _msg_='Observations are not compressed.';


Example 2: Using the OPTGETN Function

Return the setting of the CAPS option and place it in the column CAPS. The value returned is 0 if the NOCAPS form of the option is in effect, or 1 if CAPS is in effect.

caps=optgetn('caps');


See Also

OPTSETC and OPTSETN

Previous Page | Next Page | Top of Page