Flylib.com

Books Software

 
 
 

X Statement


X Statement

Issues an operating-environment command from within a SAS session

Valid: anywhere

Category: Operating Environment

See: X Statement in the documentation for your operating environment.

Syntax

X < operating-environment-command >;

Without Arguments

Using X without arguments places you in your operating environment, where you can issue commands that are specific to your environment.

Arguments

operating-environment-command

  • specifies an operating environment command that is enclosed in quotation marks.

Details

In all operating environments, you can use the X statement when you run SAS in windowing or interactive line mode. In some operating environments, you can use the X statement when you run SAS in batch or noninteractive mode.

Operating Environment Information: The X statement is dependent on your operating environment. See the SAS documentation for your operating environment to determine whether it is a valid statement on your system. Keep in mind:

  • The way you return from operating environment mode to the SAS session is dependent on your operating environment.

  • The commands that you use with the X statement are specific to your operating environment.

You can use the X statement with SAS macros to write a SAS program that can run in multiple operating environments. See SAS Macro Language: Reference for information.

Comparisons

In a windowing session, the X command works exactly like the X statement except that you issue the command from a command line. You submit the X statement from the Program Editor window.

The X statement is similar to the SYSTEM function, the X command, and the CALL SYSTEM routine. In most cases, the X statement, X command or %SYSEXEC macro statement are preferable because they require less overhead. However, the SYSTEM function can be executed conditionally. The X statement is a global statement and executes as a DATA step is being compiled.

See Also

CALL Routine:

  • CALL SYSTEM Routine on page 406

Function:

  • SYSTEM Function on page 852



Chapter 8: SAS System Options

Definition of System Options

System options are instructions that affect your SAS session. They control the way that SAS performs operations such as SAS System initialization, hardware and software interfacing, and the input, processing, and output of jobs and SAS files.



Syntax

Specifying System Options in an OPTIONS Statement

The syntax for specifying system options in an OPTIONS statement is

OPTIONS option(s) ;

where

  • option

    • specifies one or more SAS system options that you want to change.

The following example shows how to use the system options NODATE and LINESIZE= in an OPTIONS statement:

options nodate linesize=72;

Operating Environment Information: 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.

Specifying Hexadecimal Values

Hexadecimal values for system options must begin with a number (0-9), followed by an X. For example, the following OPTIONS statement sets the linesize to 160 using a hexadecimal number:

options linesize=0a0x;



Using SAS System Options

Default Settings

Operating Environment Information: SAS system options are initialized with default settings when SAS is invoked. However, the default settings for some SAS system options vary both by operating environment and by site. For details, see the SAS documentation for your operating environment.

Determining Which Settings Are in Effect

To determine which settings are in effect for SAS system options, use one of the following:

OPLIST system option

  • Writes to the SAS log the system options that were specified on the SAS invocation command line. (See the SAS documentation for your operating environment for more information.)

VERBOSE system option

  • Writes to the SAS log the system options that were specified in the configuration file and on the SAS invocation command line.

SAS System Options window

  • Lists all system option settings.

OPTIONS procedure

  • Writes system option settings to the SAS log. To display the settings of system options with a specific functionality, such as error handling, use the GROUP = option:

    proc options GROUP=errorhandling; 
    run;
    

  • (See the Base SAS Procedures Guide for more information.)

GETOPTION function

  • Returns the value of a specified system option.

VOPTION Dictionary table

  • Located in the SASHELP library, VOPTION contains a list of all current system option settings. You can view this table with SAS Explorer, or you can extract information from the VOPTION table using PROC SQL.

dictionary.options SQL table

  • Accessed with the SQL procedure, this table lists the system options that are in effect.

Determining Which SAS System Options Are Restricted

To determine which system options are restricted by your system administrator, use the RESTRICT option of the OPTIONS procedure. The RESTRICT option displays the option s value, scope, and setting. In the following example, the SAS log shows that only one option, CMPOPT, is restricted:

proc options restrict; 
run;

Output 8.1: Restricted Option Information

start example
1    proc options restrict; 
2    run; 
    SAS (r) Proprietary Software Release 9.1  TS1B0 

Option Value Information For SAS Option CMPOPT 
    Option Value: (NOEXTRAMATH NOMISSCHECK NOPRECISE NOGUARDCHECK) 
    Option Scope: SAS Session 
    How option value set:  Site Administrator Restricted
end example
 

The OPTIONS procedure displays this information for all options that are restricted. If your site administrator has not restricted any options, then the following message appears in the SAS log:

Your site administrator has not restricted any options.

Determining How a SAS System Option Value Was Set

To determine how a system option value was set, use the OPTIONS procedure with the VALUE option specified in the OPTIONS statement. The VALUE option displays the specified option s value and scope. For example, the following statements write a message to the SAS log that tells you how the option value for the system option CENTER was set:

proc options option=center value; 
run;

The following partial SAS log shows that the option value for CENTER was the shipped default.

Output 8.2: Option Value Information for the System Option CENTER

start example
2    proc options option=center value; 
3    run; 

Option Value Information for SAS Option CENTER 
    Option Value: CENTER 
    Option Scope: Default 
    How option value set:   Shipped Default
end example
 

If no value is assigned to a character system option, then SAS assigns the option a value of (a space between two single quotation marks) and Option Value displays a blank space.

Obtaining Descriptive Information about a System Option

You can quickly obtain basic descriptive information about a system option by specifying the DEFINE option in the PROC OPTIONS statement.

The DEFINE option writes the following descriptive information about a system option to the SAS log:

  • description

  • type

  • when in the SAS session it can be set

  • if it can be restricted by the system administrator

  • if the OPTSAVE procedure or the DMOPTSAVE command will save the option.

For example, the following statements write a message to the SAS log that contains descriptive information about the system option CENTER:

proc options option=center define; 
run;

Ouput 8.3: Descriptive Information for the System Option CENTER

start example
{% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %}

This partial SAS log tells you specific information about the system option CENTER.

1    proc options option=center define;
      2   run;
 CENTER
 Option Definition Information for SAS Option CENTER
    Group= LISTCONTROL
    Group Description: Procedure output and display settings
    Description: Center SAS procedure output
    Type: The option value is of type BOOLEAN
    When Can Set: Startup or anytime during the SAS Session
    Restricted: Your Site Administrator can restrict modification of this option
    Optsave: Proc Optsave or command Dmoptsave will save this option.

end example
 

Changing SAS System Option Settings

SAS provides default settings for SAS system options. You can override the default settings of any unrestricted system option in several ways. Depending on the function of the system options, you can specify a setting

  • on the command line or in a configuration file: You can specify any unrestricted SAS system option setting either on the SAS command line or in a configuration file. If you use the same option settings frequently, then it is usually more convenient to specify the options in a configuration file, rather than on the command line. Either method sets your SAS system options during SAS invocation. Many SAS system option settings can be specified only during SAS invocation. Descriptions of the individual options provide details.

  • in an OPTIONS statement: You can specify an OPTIONS statement at any time during a session except within data lines or parmcard lines. Settings remain in effect throughout the current program or process unless you reset them with another OPTIONS statement or change them in the SAS System Options window. You can also place an OPTIONS statement in an autoexec file.

  • in a SAS System Options window: If you are in a windowing environment, type options in the toolbox or on the command line to open the SAS System Options window. The SAS System Options window lists the names of the SAS system option groups. You can then expand the groups to see the option names and to change their current settings. Alternatively, you can use the Find Option command in the Options pop-up menu to go directly to an option. Changes take effect immediately and remain in effect throughout the session unless you reset them with an OPTIONS statement or change them in the SAS System Options window.

Operating Environment Information: Under UNIX, Open VMS, and z/OS operating environments, SAS system options can be restricted by a site administrator so that after they are set by the administrator, they cannot be changed by a user. Depending upon your operating environment, system options can be restricted globally, by group, or by user . You can use the OPTIONS procedure to determine which options are restricted. For more information about how to restrict options, see the SAS configuration guide for your operating environment. For more information about the OPTIONS procedure, see the SAS documentation for your operating environment.

How Long System Option Settings Are in Effect

When you specify a SAS system option setting, the setting applies to the next step and to all subsequent steps for the duration of the SAS session, or until you reset, as shown:

data one; 
   set items; 
run; 

   /* option applies to all subsequent steps */ 
options obs=5; 

  /* printing ends with the fifth observation */ 
proc print data=one; 
run; 

   /* the SET statement stops reading 
      after the fifth observation */ 
data two; 
   set items; 
run;

To read more than five observations, you must reset the OBS= system option. For more information, see OBS= System Option on page 1571.

Order of Precedence

If the same system option appears in more than one place, the order of precedence from highest to lowest is

  1. OPTIONS statement and SAS System Options window

  2. autoexec file (that contains an OPTIONS statement)

  3. command-line specification

  4. configuration file specification

  5. SAS system default settings.

Operating Environment Information: In some operating environments, you can specify system options in other places. See the SAS documentation for your operating environment.

The following table shows the order of precedence that SAS uses for execution mode options. These options are a subset of the SAS invocation options and are specified on the command line during SAS invocation.

Table 8.1: Order of Precedence for SAS Execution Mode Options

Execution Mode Option

Precedence

OBJECTSERVER

Highest

DMR

2nd

INITCMD

3rd

DMS

3rd

DMSEXP

3rd

EXPLORER

3rd

The order of precedence of SAS execution mode options consists of the following rules:

  • SAS uses the execution mode option with the highest precedence.

  • If you specify more than one execution mode option of equal precedence, SAS uses only the last option listed.

See the descriptions of the individual options for more details.

Interaction with Data Set Options

Many system options and data set options share the same name and have the same function. System options remain in effect for all DATA and PROC steps in a SAS job or session until their settings are changed. A data set option, however, overrides a system option only for the particular data set in the step in which it appears.

In this example, the OBS= system option in the OPTIONS statement specifies that only the first 100 observations will be read from any data set within the SAS job. The OBS= data set option in the SET statement, however, overrrides the system option and specifies that only the first 5 observations will be read from data set TWO. The PROC PRINT step uses the system option setting and reads and prints the first 100 observations from data set THREE:

options obs=100; 

data one; 
   set two(obs=5); 
run; 

proc print data=three; 
run;