SAS 9.1 Companion For Unix Enivronments

ABORT Statement

Stops executing the current DATA step, SAS job, or SAS session

Valid: in a DATA step

UNIX specifics: values of n

See: ABORT Statement in SAS Language Reference: Dictionary

Syntax

ABORT <ABENDRETURN>< n >;

Details

The n option enables you to specify the value of the exit status code that SAS returns to the shell when it stops executing. The value of n can range from 0 to 255.

See Also

ATTRIB Statement

Associates a format, informat, label, and/or length with one or more variables

Valid: in a DATA step

UNIX specifics: length specification

See: ATTRIB Statement in SAS Language Reference: Dictionary

Syntax

ATTRIB variable-list- 1 attribute-list -1 <... variable-list-n attribute-list-n >;

Note  

Following is a simplified explanation of the ATTRIB statement syntax. For complete syntax and its explanation, see the ATTRIB statement in SAS Language Reference: Dictionary .

attribute-list

See Also

FILE Statement

Specifies the current output file for PUT statements

Valid: in a DATA step

UNIX specifics: valid values for file-specification , host-options , and encoding-value

See: FILE Statement in SAS Language Reference: Dictionary

Syntax

FILE file-specification <ENCODING=' encoding-value '>< options >< host-options >;

file-specification

ENCODING=' encoding-value '

options

host-options

Details

The ENCODING= option is valid only when the FILE statement includes a file specification that is not a reserved fileref. If the FILE statement includes the ENCODING= argument and the reserved filerefs Log or Print as the file-specification , then SAS issues an error message. The ENCODING= value in the FILE statement overrides the value of the ENCODING= system option.

You can set the permissions of the output file by issuing the umask command from within the SAS session. For more information, see "Executing Operating System Commands from Your SAS Session" on page 13.

See Also

FILENAME Statement

Associates a SAS fileref with an external file or output device

Valid: anywhere

UNIX specifics: device-type , external-file , host-options , and encoding-value

See: FILENAME Statement in SAS Language Reference: Dictionary

Syntax

FILENAME fileref < device-type >' external-file ' <ENCODING=' encoding-value '> < host-options >;

FILENAME fileref device-type <' external-file '> <ENCODING=' encoding-value '> <' host-options '>;

FILENAME fileref (' pathname-1 ' ... 'pathname-n ') <ENCODING=' encoding-value '> <' host-options '>;

FILENAME fileref directory- name <ENCODING=' encoding-value '>;

FILENAME fileref < access-method >' external-file ' access-information ;

FILENAME fileref CLEAR _ALL_ CLEAR;

FILENAME fileref LIST _ALL_ LIST;

fileref

device-type

' external-file '

ENCODING=' encoding-value '

' host-options '

'pathname-1'...'pathname-n'

directory-name

access-method

access-information

CLEAR

_ALL_

LIST

See "Using Environment Variables to Assign Filerefs in UNIX Environments" on page 139 for more information.

See Also

FOOTNOTE Statement

Prints up to ten lines of text at the bottom of the procedure output

Valid: anywhere

UNIX specifics: maximum length of footnote

See: FOOTNOTE Statement in SAS Language Reference: Dictionary

Syntax

FOOTNOTE < n ><' text '" text ">;

Details

The maximum footnote length is 255 characters. If the length of the specified footnote is greater than the value of the LINESIZE option, SAS truncates the footnote to the line size.

%INCLUDE Statement

Includes and executes SAS statements and data lines

Valid: anywhere

UNIX specifics: source , if a file specification is used; valid values for encoding-value

See: %INCLUDE Statement in SAS Language Reference: Dictionary

Syntax

%INCLUDE source-1 <...source-n> </<SOURCE2> <S2=length><ENCODING='encoding-value'><host-options>>;

source

ENCODING= 'encoding-value'

host-options

Details

If you specify any options on the %INCLUDE statement, remember to precede the options list with a forward slash (/).

See Also

INFILE Statement

Specifies an external file to be read with an INPUT statement

Valid: in a DATA step

UNIX specifics: valid values for encoding-value , file-specification , and host-options

See: INFILE Statement in SAS Language Reference: Dictionary

Syntax

INFILE file-specification <ENCODING=' encoding-value '> < options >< host-options >;

file-specification

ENCODING= 'encoding-value'

host-options

Details

The ENCODING= option is valid only when the INFILE statement includes a file specification that is not a reserved fileref. If the INFILE statement includes the ENCODING= argument and the reserved filerefs DATALINES or DATALINES4 as a file-specification , then SAS issues an error message. The ENCODING= value in the INFILE statement overrides the value of the ENCODING= system option.

See Also

LENGTH Statement

Specifies the number of bytes that SAS uses to store a variable's value

Valid: in a DATA step

UNIX specifics: valid numeric variable lengths

See: LENGTH Statement in SAS Language Reference: Dictionary

Syntax

LENGTH < variable-1 >< ...variable-n ><$> length <DEFAULT= n >

length

DEFAULT= n

See Also

LIBNAME Statement

Associates or disassociates one or more SAS data libraries with a libref; lists the characteristics of a SAS data library

Valid: anywhere

UNIX specifics: engine , library , and engine/host-options

See: LIBNAME Statement in SAS Language Reference: Dictionary

Syntax

LIBNAME libref < engine >' SAS-data-library '< options >< engine/host-options >;

LIBNAME libref < engine >(' library-1 '<,...' library-n '>) < options >;

LIBNAME libref (' library-1 ' libref-1 ,...,' library-n ' librefn );

LIBNAME libref CLEAR_ALL _ CLEAR;

LIBNAME libref LIST_ALL _ LIST;

libref

engine

' SAS-data-library '

' library-n ' libref-n

options

engine/host-options

_ALL_

CLEAR

LIST

Details

There are two main types of engines:

View engines

Library engines

Omitting Engine Names From the LIBNAME Statement

It is always more efficient to specify the engine name than to have SAS determine the correct engine. However, if you omit an engine name in the LIBNAME statement or if you define an environment variable to serve as a libref, SAS determines the appropriate engine.

If you have specified the ENGINE= system option, SAS uses the engine name that you specified. See "ENGINE System Option" on page 327 for a discussion of the ENGINE= system option.

Note  

The ENGINE= system option specifies the default engine for data libraries on disk only.

If you did not specify the ENGINE= system option, SAS looks at the extensions of the files in the given directory and uses these rules to determine an engine:

Engine/Host Options

The LIBNAME statement accepts the following options:

FILELOCKS=NONE FAIL CONTINUE

See Also

SYSTASK Statement

Executes asynchronous tasks

Valid: anywhere

UNIX specifics: all

Syntax

SYSTASK COMMAND " host-command "

SYSTASK LIST <_ALL_ taskname > <STATE> <STATVAR>;

SYSTASK KILL taskname < taskname ...>;

COMMAND

LIST

KILL

host-command

WAIT NOWAIT

TASKNAME= taskname

MNAME= name-variable

STATUS= status-variable

SHELL<=" shell-command ">

CLEANUP

Details

SYSTASK enables you to execute host-specific commands from within your SAS session or application. Unlike the X statement, SYSTASK runs these commands as asynchronous tasks, which means that these tasks execute independently of all other tasks that are currently running. Asynchronous tasks run in the background, so you can perform additional tasks while the asynchronous task is still running.

For example, to start a new shell and execute the UNIX cp command in that shell, you might use this statement:

systask command "cp /tmp/sas* ~/archive/" taskname="copyjob1" status=copysts1 shell;

The return code from the cp command is saved in the macro variable COPYSTS1.

The output from the command is displayed in the SAS log.

Note  

Program steps that follow the SYSTASK statements in SAS applications usually depend on the successful execution of the SYSTASK statements. Therefore, syntax errors in some SYSTASK statements will cause your SAS application to abort.

There are two types of asynchronous processes that can be started from SAS:

Task

SAS/CONNECT Process

The SYSRC macro variable contains the return code for the SYSTASK statement. The status variable that you specify with the STATUS option contains the return code of the process started with SYSTASK COMMAND. To ensure that a task executes successfully, you should monitor both the status of the SYSTASK statement and the status of the process that is started by the SYSTASK statement.

If a SYSTASK statement cannot execute successfully, the SYSRC macro variable will contain a non-zero value. For example, there might be insufficient resources to complete a task or the SYSTASK statement might contain syntax errors. With the SYSTASK KILL statement, if one or more of the processes cannot be killed , SYSRC is set to a non-zero value.

When a task is started, its status variable is set to NULL. You can use the status variables for each task to determine which tasks failed to complete. Any task whose status variable is NULL did not complete execution. If a task terminates abnormally, then its status variable will be set to -1 . See "WAITFOR Statement" on page 308 for more information about the status variables.

Unlike the X statement, you cannot use the SYSTASK statement to start a new interactive session.

See Also

TITLE Statement

Specifies title lines for SAS output

Valid: anywhere

UNIX specifics: maximum length of title

See: TITLE Statement in SAS Language Reference: Dictionary

Syntax

TITLE < n ><' text '" text ">;

Details

In interactive modes, the maximum title length is 254 characters; otherwise, the maximum length is 200 characters. If the length of the specified title is greater than the value of the LINESIZE option, the title is truncated to the line size.

WAITFOR Statement

Suspends execution of the current SAS session until the specified tasks finish executing

Valid: anywhere

UNIX specifics: all

Syntax

WAITFOR <_ANY _ALL_> taskname < taskname ...> <TIMEOUT= seconds >;

taskname

_ANY_ _ALL_

TIMEOUT= seconds

Details

The WAITFOR statements suspends execution of the current SAS session until the specified task(s) finish executing or until the TIMEOUT= interval (if specified) has elapsed. If the specified task was started with the WAIT option, then the WAITFOR statement ignores that task. See "SYSTASK Statement" on page 305 for a description of the WAIT option.

For example, the following statement starts three different X Windows programs and waits for them to complete:

systask command "xv" taskname=pgm1; systask command "xterm" taskname=pgm2; systask command "xcalc" taskname=pgm3; waitfor _all_ pgm1 pgm2 pgm3;

The WAITFOR statement can be used to execute multiple concurrent SAS sessions. The following statements start three different SAS jobs and suspend the execution of the current SAS session until those three jobs have finished executing:

systask command "sas myprog1.sas" taskname=sas1; systask command "sas myprog2.sas" taskname=sas2; systask command "sas myprog3.sas" taskname=sas3; waitfor _all_ sas1 sas2 sas3;

Note  

In this method, SAS terminates after each command which can result in reduced performance. SAS/CONNECT can also be used for executing parallel SAS sessions. See SAS/CONNECT User's Guide for more information.

The SYSRC macro variable contains the return code for the WAITFOR statement. If a WAITFOR statement cannot execute successfully, the SYSRC macro variable will contain a non-zero value. For example, the WAITFOR statement may contain syntax errors. If the number of seconds specified with the TIMEOUT option elapses, then the WAITFOR statement finishes executing, and SYSRC is set to a non-zero value if

Any task whose status variable is still NULL after the WAITFOR statement has executed did not complete execution. See "SYSTASK Statement" on page 305 for a description of status variables for individual tasks.

See Also

X Statement

Issues an operating system command from within a SAS session

Valid: anywhere

UNIX specifics: valid operating system command

See: X Statement in SAS Language Reference: Dictionary

Syntax

X <' host-command '>;

host-command

Details

The X statement issues a UNIX command from within a SAS session. SAS executes the X statement immediately.

Neither the X statement nor the %SYSEXEC macro program statement is intended for use during the execution of a DATA step. The CALL SYSTEM routine, however, can be executed within a DATA step. See "CALL SYSTEM Routine" on page 239 for an example.

Note  

The X statement is not supported without arguments under the X Window System.

See Also

Категории