Setting System Options

The Basics of System Options

Note: The options below do not affect the appearance of HTML output. HTML is the recommended method setting for output.
System options are instructions that affect the processing of an entire SAS program or SAS session from the time the option is specified until it is changed. If you create your procedure output as LISTING output, you can also control the appearance of your output by setting these system options:
  • line size (the maximum width of the log and output)
  • page size (the number of lines per printed page of output)
  • the display of page numbers
  • the display of date and time
All SAS system options have default settings that are used unless you specify otherwise. For example, page numbers are automatically displayed in LISTING output (unless your site modifies this default).
Figure 3.17 LISTING Output Showing Default Settings
LISTING Output Showing Default Settings

Changing System Options

To modify system options in your LISTING output, you submit an OPTIONS statement. You can place an OPTIONS statement anywhere in a SAS program to change the settings from that point on. However, it is good programming practice to place OPTIONS statements outside DATA or PROC steps so that your programs are easier to read and debug.
Because the OPTIONS statement is global, the settings remain in effect until changed or canceled, or until the SAS session ends.
Syntax, OPTIONS statement:
OPTIONS options;
options specifies one or more system options to be changed. The available system options depend on your host operating system.

Options for Printed Results

Here are some system options that affect the appearance of LISTING output.
Table 3.3 Selected System Options and Their Descriptions
CENTER | NOCENTER
controls whether output is centered or left-justified. The default is CENTER.
DATE | NODATE
controls whether or not today’s date appears at the top of each page of output. The default is DATE.
NUMBER | NONUMBER
controls whether or not page numbers appear on each page of SAS output. The default is NUMBER.
ORIENTATION= orientation
specifies the orientation for printing output, either LANDSCAPE or PORTRAIT. The default is PORTRAIT.
PAGENO= n
starts numbering output pages with n. The default is 1.
RIGHTMARGIN= n
specifies the size of the margin (such as 0.75in or 2cm) to be used for printing output. The default is 0.00in.
LEFTMARGIN= n
TOPMARGIN= n
BOTTOMMARGIN= n

Handling Two-Digit Years

If you use two-digit year values in your data lines, external files, or programming statements, you should consider another important system option, the YEARCUTOFF= option. This option specifies which 100-year span is used to interpret two-digit year values.
Figure 3.18 The Default 100 Year Span in SAS
The Default 100 Year Span in SAS
All versions of SAS represent dates correctly from 1582 C.E. to 20,000 C.E. (Leap years, century, and fourth-century adjustments are made automatically. Leap seconds are ignored, and SAS does not adjust for daylight saving time. You use SAS informats to read date, times, and datetime values to account for various time zones. However, you should be aware of the YEARCUTOFF= value to ensure that you are properly interpreting two-digit years in data lines.
As with other system options, you specify the YEARCUTOFF= option in the OPTIONS statement:
options yearcutoff=1925;

How the YEARCUTOFF= Option Works

When a two-digit year value is read, SAS interprets it based on a 100-year span that starts with the YEARCUTOFF= value. The default value of YEARCUTOFF= is 1926.
Figure 3.19 Default YEARCUTOFF= Date (1926)
Default YEARCUTOFF= Date (1926)
Table 3.4 Date Expressions and How They Are Displayed (YEARCUTOFF= 1926)
Date Expression
Displayed Value
12/07/41
12/07/1941
18Dec15
18Dec2015
04/15/30
04/15/1930
15Apr95
15Apr1995
However, you can override the default and change the value of YEARCUTOFF= to the first year of another 100-year span. For example, if you specify YEARCUTOFF=1950, then the 100-year span is from 1950 to 2049.
options yearcutoff=1950;
Using YEARCUTOFF=1950, dates are interpreted as shown below:
Figure 3.20 Interpreting Dates When YEARCUTOFF=1950
YEARCUTOFF=1950
Table 3.5 Date Expressions and How They Are Displayed (YEARCUTOFF= 1950)
Date Expression
Displayed Value
12/07/41
12/07/2041
18Dec15
18Dec2015
04/15/30
04/15/2030
15Apr95
15Apr1995

Handling Four-Digit Years

Remember, the value of the YEARCUTOFF= system option affects only two-digit year values. A date value that contains a four-digit year value is interpreted correctly even if it does not fall within the 100-year span that is set by the YEARCUTOFF= system option.
For more information about reading date values, see SAS Date and Time Values.

Using System Options to Specify Observations

Besides using SAS system options to change the appearance of output and interpret two-digit year values, you can also use the FIRSTOBS= and OBS= system options to specify the observations to process from SAS data sets.
Specify either or both of these options as needed.
  • FIRSTOBS= starts processing at a specific observation.
  • OBS= stops processing after a specific observation.
Note: Using FIRSTOBS= and OBS= together processes a specific group of observations.
CAUTION:
Each of these options applies to every input data set that is used in a program or a SAS process.
Syntax, FIRSTOBS=, and OBS= options in an OPTIONS statement:
FIRSTOBS=n
OBS=n
n is a positive integer. For FIRSTOBS=, n specifies the number of the first observation to process. For OBS=, n specifies the number of the last observation to process. By default, FIRSTOBS=1. The default value for OBS= is MAX, which is the largest signed, 8-byte integer that is representable in your operating environment. The number can vary depending on your operating system.

Examples: FIRSTOBS= and OBS= Options

The data set clinic.heart contains 20 observations. If you specify FIRSTOBS=10, SAS reads the 10th observation of the data set first and reads through the last observation (for a total of 11 observations).
options firstobs=10; 
proc print data=clinic.heart; 
run;
Here is the output:
Figure 3.21 PROC PRINT Output with FIRSTOBS=10
PROC PRINT Output with FIRSTOBS=10
If you specify OBS=10 instead, SAS reads through the 10th observation. In this case, that is for a total of 10 observations. Notice that FIRSTOBS= has been reset to the default value.
options firstobs=1 obs=10; 
proc print data=clinic.heart; 
run;
Here is the output:
Figure 3.22 PROC PRINT Output with FIRSTOBS=1 and Obs=10
PROC PRINT Output with FIRSTOBS=1 and Obs=10
Combining FIRSTOBS= and OBS= processes observations in the middle of the data set. For example, the following program processes only observations 10 through 15, for a total of 6 observations:
options firstobs=10 obs=15; 
proc print data=clinic.heart; 
run;
Here is the output:
Figure 3.23 PROC PRINT Output with FIRSTOBS=10 and Obs=15
PROC PRINT Output with FIRSTOBS=10 and Obs=15
To reset the number of the last observation to process, you can specify OBS=MAX in the OPTIONS statement.
options obs=max;
This instructs any subsequent SAS programs in the SAS session to process through the last observation in the data set that is being read.

Using FIRSTOBS= and OBS= for Specific Data Sets

Using the FIRSTOBS= or OBS= system options determines the first or last observation, respectively, that is read for all steps for the duration of your current SAS session or until you change the setting. However, you can still do the following:
  • override these options for a given data set
  • apply these options to a specific data set only
To affect any single file, use FIRSTOBS= or OBS= as data set options instead of as system options. You specify the data set option in parentheses immediately following the input data set name.
Tip
A FIRSTOBS= or OBS= specification from a data set option overrides the corresponding FIRSTOBS= or OBS= system option.

Example: FIRSTOBS= and OBS= as Data Set Options

As shown in the following example, this program processes only observations 10 through 15, for a total of 6 observations:
options firstobs=10 obs=15; 
proc print data=clinic.heart; 
run;
You can create the same output by specifying FIRSTOBS= and OBS= as data set options, as follows. The data set options override the system options for this instance only.
options firstobs=10 obs=15; 
proc print data=clinic.heart(firstobs=20 obs=30); 
run;
To specify FIRSTOBS= or OBS= for this program only, you could omit the OPTIONS statement altogether and simply use the data set options.

The SAS System Options Window

Note: There is no SAS System Options window in Enterprise Guide or SAS Studio. Use the OPTIONS statement to change system options.
You can also set system options by using the SAS System Options window. The changed options are reset to the defaults at the end of your SAS session.
To view the SAS System Options window, select Tools>Options>System.
Figure 3.24 The SAS System Options Window
The SAS System Options Window

Changing Options

To change an option:
  1. Expand the groups and subgroups under SAS Options Environment until you find the option that you want to change. Options in subgroups are listed in the right pane of the window.
  2. Click the name of the option that you want to change, and display its pop-up menu. Specify either of the following:
    • Modify Value opens a window in which you enter or select a new value for the option.
    • Set to Default immediately resets the option to its default value.

Finding Options Quickly

To locate an option in the SAS System Options window:
  1. Place your cursor over the name of any option group or subgroup, and display its pop-up menu.
  2. Click Find Option. The Find Option dialog box appears.
  3. Enter the name of the option that you want to locate, and click OK.
The SAS System Options window expands to the appropriate option subgroup. All subgroup options also appear, and the option that you located is highlighted.
Last updated: January 10, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.7.131