SAS-OPTIONS

Important and Commonly used SAS System options

Option AUTOSAVELOC
Information:
Specifies the location of the Program Editor autosave file. If you want to autosave the SAS programs you are currently working on, this option has to be used.



Syntax: AUTOSAVELOC= "destination"
Usage: options AUTOSAVELOC= "C:\SAS\Sas Codes";
Default: Enabled - 10 Minutes
Additional Info:
To ensure that you do not lose any of your work in the Program Editor, SAS can automatically save your files at an interval you specify. The interval can range from 0 (Autosave off) to 480 minutes. The default interval is 10 minutes. The autosave file is saved as pgm.asv in the current folder or in the location specified by the AUTOSAVELOC system option.

To enable or disable autosave and set the interval:
  • Select Tools->Options->Preferences->Edit tab
  • Select or deselect Autosave every.
  • Set the interval by typing a number between 1 and 480 in the minute’s box.
You can also use the WAUTOSAVE command to enable, disable, and set the interval. WAUTOSAVE
INTERVAL=minutes will turn on autosave using minutes as the interval.

Option DATASTMTCHK
Information:
It is possible to wipe out unintentionally an input data set when you omit a semicolon on the DATA statement. If the next statement is SET, MERGE, or UPDATE, the original data set is overwritten. Different, but significant, problems arise when the next statement is RETAIN. DATASTMTCHK= enables you to protect yourself against overwriting the input data set.

Syntax: DATASTMTCHK=COREKEYWORDS | ALLKEYWORDS | NONE
Usage: OPTION DATASTMTCHK = COREKEYWORDS
Default: OPTION DATASTMTCHK = COREKEYWORDS


Option CLEANUP
Information:
Specifies that during the entire session, SAS attempts to perform automatic, continuous clean-up of resources that are not essential for execution. Nonessential resources include those that are not visible to the user (for example, cache memory) and those that are visible to the user (for example, the KEYS windows). When CLEANUP is in effect and an out-of-resource condition occurs (except for a disk-full condition), a requestor window is not displayed, and no intervention is required by the user. When CLEANUP is in effect and a disk-full condition occurs, a requester window displays that allows the user to decide how to proceed.


Syntax: CLEANUP | NOCLEANUP
Usage: options CLEANUP;
Default: NOCLEANUP


Option FMTSEARCH
Information:
When SAS finds a reference to a user-defined format or informat, it will look for a format catalog called work.Formats. If it finds no such format catalog, or if it does not find the user-defined format in that catalog, it will look for a catalog called library.Formats. If it has no luck there, SAS will go no further unless you tell it where to look. If you name a format catalog anything other than Formats or store it in a library with a libRef other than library, you will need to use the fmtSearch= option to tell SAS where to find the formats. List the format catalogs in parentheses starting with the one you want to search first. SAS searches the format catalogs in the order listed, until the desired member is found. The value of the catalog specification can be either the libRef or libRef.catalog. If only the libRef is given, SAS assumes that Formats is the catalog name.

Syntax: FMTSEARCH=(catalog-specification-1... catalog-specification-n)
Usage: options FMTSEARCH=(catalog1 catalog3 catalog3);
Default: It searches in all catalogs available. If work and library are not part of the catalogs list specified, they are searched first.


Option NOERRORABEND
Information:
The system option ERRORABEND forces an abend(Abnormal End) to occur only when a PROC step is active. The ABORT statement is misplaced in the DATA step below. The system option ERRORABEND does not cause an abend to occur because a PROC step is not active.

Syntax: errorabend
Usage: options errorabend;
Default: Not Enabled.
Additional Info:
You can use the following system options to control error handling (resolve errors) in your program:

  • BYERR - specifies whether SAS produces errors when the SORT procedure attempts to process a _NULL_ data set.
  • DKRICOND - specifies the level of error detection to report when a variable is missing from an input data set during the processing of a DROP=, KEEP=, and RENAME= data set option.
  • DKROCOND - specifies the level of error detection to report when a variable is missing from an output data set during the processing of a DROP=, KEEP=, and RENAME= data set option.
  • DSNFERR - when a SAS data set cannot be found, specifies whether SAS issues an error message.
  • ERRORABEND-specifies whether SAS responds to errors by terminating.
  • ERRORCHECK- specifies whether SAS enters syntax-check mode when errors are found in the LIBNAME, FILENAME, %INCLUDE, and LOCK statements.
  • ERRORS-specifies the maximum number of observations for which SAS issues complete error messages.
  • FMTERR-when a variable format cannot be found, specifies whether SAS generates an error or continues processing.
  • INVALIDDATA-specifies the value that SAS assigns to a variable when invalid numeric data is encountered.
  • MERROR-specifies whether SAS issues a warning message when a macro-like name does not match a macro keyword.
  • SERROR-specifies whether SAS issues a warning message when a macro variable reference does not match a macro variable.
  • STEPCHKPT-specifies whether checkpoint-restart data is to be recorded for a batch program.
  • STEPCHKPTLIB-specifies the libref of the library where checkpoint-restart data is saved.
  • STEPRESTART-specifies whether to execute a batch program by using checkpoint-restart data.
  • VNFERR-specifies whether SAS issues an error or warning when a BY variable exists in one data set but not another data set when processing the SET, MERGE, UPDATE, or MODIFY statements.

Option MSGLEVEL=
Information:
Controls the level of detail in messages that are written to the SAS log.

Syntax: MSGLEVEL= N | I (N-Prints notes, warnings, and error messages only. I-prints additional notes pertaining to index usage, merge processing, sort utilities, and CEDA usage, along with standard notes, warnings, and error messages.))
Usage: options msglevel=i;
Default: N.
Additional Info:
If msglevel=i, It will be useful in cases like...

SAS writes a warning to the SAS log when a MERGE statement would cause variables to be overwritten
SAS writes a message that indicates which sorting product was used.
SAS writes a message that indicates when CEDA (Cross Environment Data Access) is being used to process a SAS file.

Option REALMEMSIZE
Information:
Indicates the amount of virtual memory SAS can expect to allocate. Use the REALMEMSIZE system option to optimize the performance of SAS procedures that alter their algorithms and memory usage. Setting the value of REALMEMSIZE too low or too high may result in less than optimal performance.


Syntax: -REALMEMSIZE n | nK | nM | nG | hexX | MIN | MAX
Usage: options -REALMEMSIZE MAX;
Default: 0.Determined by SAS when SAS starts


Option SLEEPWINDOW
Information:
Enables or disables the SLEEP window. The SLEEP window appears when the SLEEP function or the WAKEUP function suspends the execution of a DATA step. The SLEEP window displays the time that remains before the DATA step begins running.

Syntax: -SLEEPWINDOW | -NOSLEEPWINDOW
Usage: options -SLEEPWINDOW;
Default: Enabled.

Option INVALIDDATA
Information:
Specifies the value SAS is to assign to a variable when invalid numeric data are encountered. The INVALIDDATA= system option specifies the value that SAS is to assign to a variable when invalid numeric data are read with an INPUT statement or the INPUT function.

Syntax: INVALIDDATA='character'
Usage: options INVALIDDATA='xyz';
Default: The default value is a period (.).
Additional Info:
The syntax that is shown here applies to the OPTIONS statement. On the command line or in a configuration file, the syntax is specific to your operating environment. For details, see the SAS documentation for your operating environment.

Option ERRORS
Information:
Controls the maximum number of observations for which complete error messages are printed. If data errors are detected in more than n observations, processing continues, but error messages do not print for the additional errors. Note: If you set ERRORS=0 and an error occurs, a note displays in the log which states that the limit set by the ERRORS option has been exceeded.

Syntax: ERRORS=n| nK | nM | nG | nT | MIN| MAX | hexX
Usage: options errors=1; (Prints only one error and the system stops processing)
Default: By default it prints all errors.
Additional Info:
The syntax that is shown here applies to the OPTIONS statement. On the command line or in a configuration file, the syntax is specific to your operating environment. For details, see the SAS documentation for your operating environment.


Option COMPRESS
Information:
Controls the compression of observations in output SAS datasets.

Syntax: COMPRESS=NO | YES | CHAR | BINARY (CHAR | BINARY specified compression techniques)
Usage: options COMPRESS=YES;
Default: NO.
Additional Info:
Compressing a file is a process that reduces the number of bytes required to represent each observation. Advantages of compressing a file include reduced storage requirements for the file and fewer I/O operations necessary to read or write to the data during processing. However, more CPU resources are required to read a compressed file (because of the overhead of uncompressing each observation), and there are situations when the resulting file size may increase rather than decrease. Use the COMPRESS= system option to compress all output data sets that are created during a SAS session. Use the option only when you are creating SAS data files (member type DATA). You cannot compress SAS views, because they contain no data.

Option REUSE
Information:
Specifies whether new observations are written to free space in compressed SAS datasets. If space is reused, observations that are added to the SAS data set are inserted wherever enough free space exists, instead of at the end of the SAS data set. Specifying REUSE=NO results in less efficient usage of space if you delete or update many observations in a SAS data set. However, the APPEND procedure, the FSEDIT procedure, and other procedures that add observations to the SAS data set continue to add bservations to the end of the data set, as they do for uncompressed SAS data sets.

Syntax: REUSE=YES | NO
Usage: options REUSE=YES;
Default: NO.
Additional Info:
The REUSE= data set option overrides the REUSE= system option.

PERFORMANCE NOTE: When using COMPRESS=YES and REUSE=YES system options settings, observations cannot be addressed by observation number.
Note that REUSE=YES takes precedence over the POINTOBS=YES data set option setting.

Option OBS
Information:
This system option specifies when to stop processing observations or records in the dataset. OBS= tells SAS when to stop processing observations or records. To determine when to stop processing, SAS uses the value for OBS= in a formula that includes the value for OBS= and the value for FIRSTOBS=. The formula is (obs - firstobs) + 1 = results. For example, if OBS=10 and FIRSTOBS=1 (which is the default for FIRSTOBS=), the result is 10 observations or records, that is (10 - 1) + 1 = 10. If OBS=10 and FIRSTOBS=2, the result is nine observations or records, that is, (10 - 2) + 1 = 9.

Syntax: OBS= n | nK | nM | nG | nT | hexX | MIN | MAX
Usage: options OBS=20;
Default: MAX. ie. Alll records in the dataset.
Additional Info:
You can also use OBS= to control analysis of SAS data sets in PROC steps. E.g: Proc Print

Option YEARCUTOFF
Information:
Specifies the first year of a 100-year span that will be used by date informats and functions to read a two-digit year. The YEARCUTOFF= value is the default that is used by various date and datetime informats and functions. If the default value of nnnn (1920) is in effect, the 100-year span begins with 1920 and ends with 2019. Therefore, any informat or function that uses a two-digit year value that ranges from 20 to 99 assumes a prefix of 19. For example, the value 92 refers to the year 1992.

Syntax: YEARCUTOFF= nnnn | nnnnn
Usage: options YEARCUTOFF=1950;
Default: 1920
Additional Info:
YEARCUTOFF= has no effect on existing SAS dates or dates that are read from input data that include a four-digit year, except those with leading zeroes. For example, 0076 with yearcutoff=1990 indicates 1976.

 Option MPRINT
Information:
Displays the SAS statements that are generated by macro execution. This is useful for debugging macros. The MPRINT option displays the text generated by macro execution. Each SAS statement begins a new line. Each line of MPRINT output is identified with the prefix MPRINT(macro-name):, to identify the macro that generates the statement. Tokens that are separated by multiple spaces are printed with one intervening space. Each statement ends with a semicolon.

Syntax: MPRINT | NOMPRINT
Usage: options MPRINT;
Default: NOMPRINT - It does not print the statements
Additional Info:
You can direct MPRINT output to an external file by also using the MFILE option and assigning the fileref MPRINT to that file. For more information, see MFILE System Option.


Option MLOGIC
Information:
Causes the macro processor to trace its execution and to write the trace information to the SAS log. This option is a useful debugging tool. Each line generated by the MLOGIC option is identified with the prefix MLOGIC (macro-name):. If MLOGIC is in effect and the macro processor encounters a macro invocation, the macro processor displays messages that identify 1. The beginning of macro execution 2. Values of macro parameters at invocation 3. Execution of each macro program statement 4. Whether each %IF condition is true or false 5. The ending of macro execution.

Syntax: MLOGIC | NOMLOGIC
Usage: options MLOGIC;
Default: NOMLOGIC - It does not print.
Additional Info:
Using MLOGIC can produce a great deal of output.

Option SYMBOLGEN
Information:
Displays the results of resolving macro variable references. This option is useful for debugging. SYMBOLGEN displays the results in the form: "SYMBOLGEN: Macro variable name resolves to value" This option also indicates when a double ampersand (&& ) resolves to a single ampersand (& ).

Syntax: SYMBOLGEN | NOSYMBOLGEN
Usage: options SYMBOLGEN;
Default: NOSYMBOLGEN - It does not print.
Additional Info:
It also has an alias that can be remembered easily. SGEN | NOSGEN.

Option SASMSTORE
Information:
specifies the libref of a SAS library that contains, or will contain, a catalog of stored compiled SAS macros. This libref cannot be WORK.

Syntax: SASMSTORE = libref;
Usage:  options MSTORED SASMSTORE = libref;
             libname libref "";

Default: NOMSTORED
Additional info:
It is used with MSTORED.

MSTORED specifies that the macro facility search for stored compiled macros in the SASMACRO catalog of the SAS data library that is referenced by the SASMSTORE option. Regardless of the setting of MSTORED, the macro facility first searches for macros in the SASMACR catalog in the WORK library. If you specify MSTORED and the desired macro is not found in the WORK library, the macro facility searches the SASMACR catalog in the SAS data library that is referenced by SASMSTORE. If you specify NOMSTORED, the subsequent search is not performed.
Option REALMEMSIZE=

Information:

Use the REALMEMSIZE= system option to optimize the performance of SAS procedures that alter their algorithms and memory usage. Setting the value of REALMEMSIZE= too low might result in less than optimal performance.

Syntax: n | nK | nM | nG | hexX | MIN | MAX
Usage: options REALMEMSIZE = ;
Default: 0
Additional Info:
n | nK | nM | nG
specifies the amount of memory to reserve in multiples of 1 (bytes); 1,024 (kilobytes); 1,048,576 (megabytes); or 1,073,741,824 (gigabytes), respectively. The value of n can be a decimal value. For example, a value of 8 specifies 8 bytes, a value of .782k specifies 801 bytes, and a value of 3m specifies 3,145,728 bytes.
hexX
specifies the amount of memory as a hexadecimal value. You must specify the value beginning with a number (0-9), followed by hex digits (0-9, A-F), and then followed by an X. For example, the value 2dx sets the amount of memory to 45 bytes.
MIN
specifies a value of 0, which indicates that the memory usage is determined by SAS when SAS starts. This is the default value and should not be changed under normal conditions.
MAX
specifies to set the memory size to the largest permissible value.

 Option MISSING
Information:
Use the MISSING = 'Character' system option to specify a character for the missing numeric values.

Syntax:MISSING='character'
Usage: options MISSING = 'N'


Option TERMSTMT
Information:
Specifies the SAS statements to be executed at SAS termination.

Syntax :TERMSTMT='statement(s)'
Usage: TERMSTMT= is fully supported in batch mode. In interactive modes, TERMSTMT= is executed only when you submit the ENDSAS statement from an editor window to terminate the SAS session. Terminating SAS by any other means in interactive mode results in TERMSTMT= not being execute


Option MergeNoBy=error
Information:
Sometimes unintentionally we merge the data sets without the “By ….” statement, which can cause total chaos to our result data. Fortunately SAS allows us to refuse such instruction. The MergeNoBy=error option will not let user create such data set. It will show EROR Msg. in the Log.
If we specify something like Options mergeNoBy = Warn; (This is default case in SAS9.1 edition.)
We will get a Warning in the Log and data set will be created.

If we change this option to Options mergeNoBy = error;
We will get Error in Log and data set will not be created.
ERROR: No BY statement was specified for a MERGE statement.
WARNING: The data set LIB.MERGE may be incomplete. When this step was stopped there were 0 observations and 4 variables.

On the rare occasion that you do want to merge with no By statement, code
Options mergeNoBy=noWarn ; immediately before the Data step and
Options mergeNoBy=error ; immediately after.

Syntax: MergeNoBy = Error/Warn/NoWarn
Usage: Options MergeNoBy = Error;  While merging the data sets, whether user want to use “By” statement or not.
Default: WARNING, SAS9.1 will warn the user and also create the data set.

Blog Widget by LinkWithin

Search this blog..

Loading