Returns the value of a SAS system or graphics option.
Category: | Special |
is a character constant, variable, or expression that specifies the name of the system option.
Tips | Do not put an equal sign after the name. For example, write PAGESIZE= as PAGESIZE. |
SAS options that are passwords, such as EMAILPW and METAPASS,
return the value xxxxxxxx , and not the actual
password.
|
returns the default option value.
Restriction | DEFAULTVALUE is valid only for SAS system options. SAS issues a warning message when the DEFAULTVALUE option is specified and option-name is a graphics option. |
returns a character string that specifies the scope of an option.
Restriction | HOWSCOPE is valid only for SAS system options. SAS issues a warning message when the HOWSCOPE option is specified and option-name is a graphics option. |
returns a character string that specifies how an option value was set.
Restriction | HOWSET is valid only for SAS system options. SAS issues a warning message when the HOWSET option is specified and option-name is a graphics option. |
returns the system option value that was used to start SAS either on the command line or in a configuration file.
Restriction | STARTUPVALUE is valid only for SAS system options. SAS issues a warning message when the STARTUPVALUE option is specified and option-name is a graphics option. |
reports graphic units of measure in centimeters.
Restriction | CM is valid only for graphics options and the following SAS system options: BOTTOMMARGIN, TOPMARGIN, RIGHTMARGIN, and LEFTMARGIN. SAS writes a note to the log when the CM option is specified and option-name is not a graphics option or an option that specifies a margin value. |
for options that contain environment variables, returns the option value with the value of the environment variable.
Restrictions | Variable expansion is valid only in the Windows and UNIX operating environments. |
EXPAND is valid only for character system option values. EXPAND is ignored if option-name has an option type of Boolean, such as CENTER or NOCENTER, or if the value of the option is numeric. | |
Note | SAS issues a note when EXPAND is specified for Boolean options and for options that have numeric values. SAS issues a warning when EXPAND is specified and the option is a graphics option. |
Tip | By default, some option values are displayed with expanded
variable values. Other options require the EXPAND option in the PROC
OPTIONS statement. Use the DEFINE option in the PROC OPTIONS statement
to determine whether an option value expands variables by default
or if the EXPAND option is required. If the output from PROC OPTIONS
DEFINE shows the following information, you must use the EXPAND option
to expand variable values:Expansion: Environment variables, within the option value, are not expanded |
for options that contain environment variables, returns the value in the format option-name=value.
Restriction | KEYEXPAND is valid only for character system option values. SAS issues an error message when the KEYEXPAND option is specified and option-name is a graphics option. KEYEXPAND is ignored if option-name has an option type of Boolean, such as CENTER or NOCENTER, or if the value of the option is numeric. |
returns option values in a option-name=value format that would be suitable for direct use in the SAS OPTIONS or GOPTIONS global statements.
Restrictions | KEYWORD is not valid when it is used with the HEXVALUE, EXPAND, KEYEXPAND, or LOGNUMBERFORMAT options. SAS writes a note to the log when the GETOPTION function contains conflicting options. |
KEYWORD is valid only for character or numeric system option values. KEYWORD is ignored for system options whose option type is Boolean, such as CENTER or NOCENTER. SAS issues an error message when the KEYWORD option is specified and option-name is a graphics option. | |
Note | For a system option with a null value, the GETOPTION function returns a value of ' ' (single quotation marks with a blank space between them). An example is EMAILID=' '. |
returns the option value as a hexadecimal value.
Restriction | HEXVALUE is valid only for character or numeric system option values. If HEXVALUE is specified for system options whose option type is Boolean, such as CENTER or NOCENTER, or if option-name is a graphics option, SAS issues an error message. |
reports graphic units of measure in inches.
Restriction | IN is valid only for graphics options and the following SAS system options: BOTTOMMARGIN, TOPMARGIN, RIGHTMARGIN, and LEFTMARGIN. SAS writes a note to the log when the IN option is specified and option-name is not a graphics option or an option that specifies a margin value. |
formats SAS system option values using locale-specific punctuation.
Restriction | Do not use LOGNUMBERFORMAT if the returned value is used to set an option value by using the OPTIONS statement. The OPTIONS statement does not accept commas in numeric values. |
/* Save the value of the YEARCUTOFF system option */ %let cutoff=%sysfunc(getoption(yearcutoff,keyword)); data ages; if getoption('yearcutoff') = '1920' then do; ...more SAS statements... end; else do; ...more SAS statements... /* Reset YEARCUTOFF */ options &cutoff; end; run;
%macro showopts; %put MAPS= %sysfunc( getoption(MAPS)); %put MAPSEXPANDED= %sysfunc( getoption(MAPS, EXPAND)); %put PAGESIZE= %sysfunc( getoption(PAGESIZE)); %put PAGESIZESETBY= %sysfunc( getoption(PAGESIZE, HOWSET)); %put PAGESIZESCOPE= %sysfunc( getoption(PAGESIZE, HOWSCOPE)); %put PS= %sysfunc( getoption(PS)); %put LS= %sysfunc( getoption(LS)); %put PS(keyword form)= %sysfunc( getoption(PS,keyword)); %put LS(keyword form)= %sysfunc( getoption(LS,keyword)); %put FORMCHAR= %sysfunc( getoption(FORMCHAR)); %put HSIZE= %sysfunc( getoption(HSIZE)); %put VSIZE= %sysfunc( getoption(VSIZE)); %put HSIZE(in/keyword form)= %sysfunc( getoption(HSIZE,in,keyword)); %put HSIZE(cm/keyword form)= %sysfunc( getoption(HSIZE,cm,keyword)); %put VSIZE(in/keyword form)= %sysfunc( getoption(VSIZE,in,keyword)); %put HSIZE(cm/keyword form)= %sysfunc( getoption(VSIZE,cm,keyword)); %mend; goptions VSIZE=8.5 in HSIZE=11 in; options PAGESIZE=67; %showopts
NOTE: PROCEDURE PRINTTO used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 6 %macro showopts; 7 %put MAPS= %sysfunc( 8 getoption(MAPS)); 9 %put MAPSEXPANDED= %sysfunc( 10 getoption(MAPS, EXPAND)); 11 %put PAGESIZE= %sysfunc( 12 getoption(PAGESIZE)); 13 %put PAGESIZESETBY= %sysfunc( 14 getoption(PAGESIZE, HOWSET)); 15 %put PAGESIZESCOPE= %sysfunc( 16 getoption(PAGESIZE, HOWSCOPE)); 17 %put PS= %sysfunc( 18 getoption(PS)); 19 %put LS= %sysfunc( 20 getoption(LS)); 21 %put PS(keyword form)= %sysfunc( 22 getoption(PS,keyword)); 23 %put LS(keyword form)= %sysfunc( 24 getoption(LS,keyword)); 25 %put FORMCHAR= %sysfunc( 26 getoption(FORMCHAR)); 27 %put HSIZE= %sysfunc( 28 getoption(HSIZE)); 29 %put VSIZE= %sysfunc( 30 getoption(VSIZE)); 31 %put HSIZE(in/keyword form)= %sysfunc( 32 getoption(HSIZE,in,keyword)); 33 %put HSIZE(cm/keyword form)= %sysfunc( 34 getoption(HSIZE,cm,keyword)); 35 %put VSIZE(in/keyword form)= %sysfunc( 36 getoption(VSIZE,in,keyword)); 37 %put HSIZE(cm/keyword form)= %sysfunc( 38 getoption(VSIZE,cm,keyword)); 39 %mend; 40 goptions VSIZE=8.5 in HSIZE=11 in; 41 options PAGESIZE=67; 42 %showopts MAPS= ("!sasroot\maps-path\en\maps") MAPSEXPANDED= ("C:\maps-path\en\maps") PAGESIZE= 67 PAGESIZESETBY= Options Statement PAGESIZESCOPE= Line Mode Process PS= 67 LS= 78 PS(keyword form)= PS=67 LS(keyword form)= LS=78 FORMCHAR= ‚ƒ„…†‡ˆ‰Š‹Œ+=|-/\<>* HSIZE= 11.0000 in VSIZE= 8.5000 in HSIZE(in/keyword form)= HSIZE=11.0000 in HSIZE(cm/keyword form)= HSIZE=27.9400 cm VSIZE(in/keyword form)= VSIZE=8.5000 in HSIZE(cm/keyword form)= VSIZE=21.5900 cm 43 proc printto; run;
/* Check the value of papersize before we change it. */ /* The initial value is A4 as this value was used when */ /* SAS started. */ %put %sysfunc(getoption(papersize,keyword)); /* Change the PAPERSIZE value and check the change. */ options papersize="600x800 Pixels"; %put %sysfunc(getoption(papersize,keyword)); /* Change PAPERSIZE back to the default value and check it. */ /* RESULT: LETTER */ %let defsize = %sysfunc(getoption(papersize,keyword,defaultvalue)) ; options &defsize; run; %put %sysfunc(getoption(papersize,keyword)); /* Change the value to the startup value and check it. */ /* RESULT: A4 */ %let defsize = %sysfunc(getoption(papersize,keyword,startupvalue)) ; options &defsize; run; %put %sysfunc(getoption(papersize,keyword));
22 /* Check the value of papersize before we change it. */ 23 /* The initial value is A4 as this value was used when */ 24 /* SAS started. */ 25 26 %put %sysfunc(getoption(papersize,keyword)); PAPERSIZE=A4 27 28 /* Change the PAPERSIZE value and check the change. */ 29 30 options papersize="600x800 Pixels"; 31 32 %put %sysfunc(getoption(papersize,keyword)); PAPERSIZE=600X800 PIXELS 33 34 /* Change PAPERSIZE back to the default value and check it. */ 35 /* RESULT: LETTER */ 36 37 %let defsize = %sysfunc(getoption(papersize,keyword,defaultvalue)) ; 38 options &defsize; run; 39 %put %sysfunc(getoption(papersize,keyword)); PAPERSIZE=LETTER 40 41 /* Change the value to the startup value and check it. */ 42 /* RESULT: A4 */ 43 44 %let defsize = %sysfunc(getoption(papersize,keyword,startupvalue)) ; 45 options &defsize; run; 46 %put %sysfunc(getoption(papersize,keyword)); PAPERSIZE=A4