A SAS statement is a directive to SAS that either requests that SAS perform a certain operation or provides information to the system that might be necessary for later operations.
All SAS statements are described in SAS Language Reference: Dictionary . Those that are described here have syntax and usage that are specific to Windows.
Stops executing the current DATA step, SAS job, or SAS session
Valid in: a DATA step
Windows specifics: Action of the ABEND and RETURN options; maximum value of condition-code
See: ABORT Statement in SAS Language Reference: Dictionary
ABORT <ABEND RETURN> < n >;
ABEND
causes abnormal termination of the current SAS job or session for the current process. Further action is based on how your operating environment and site treat jobs that end abnormally.
RETURN
causes the immediate normal termination of the current SAS job or session. A condition code is returned indicating an error if a job ends abnormally.
n
allows you to specify a condition code that SAS returns to its calling program. The value of n must be an integer. Return codes 0 - 6 and those greater than 997 are used by SAS.
The ABORT statement causes SAS to stop processing the current DATA step.
The ABEND and RETURN options both terminate the SAS process, job, or session.
'Return Codes and Completion Status' on page 597
Associates a format, informat, label, and length with one or more variables
Valid in: a DATA step
Windows specifics: length specification
See: ATTRIB Statement in SAS Language Reference: Dictionary
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 the complete syntax and its explanation, see the ATTRIB statement in SAS Language Reference: Dictionary .
attribute-list
LENGTH=<$> length
specifies the length of the variables in variable-list . Under Windows, the length you can specify for a numeric variable ranges from 3 to 8 bytes.
Using the ATTRIB statement in the DATA step permanently associates attributes with variables by changing the descriptor information of the SAS data set that contains the variables.
Specifies the current output file for PUT statements
Valid in: a DATA step
Windows specifics: Valid values for file specification ; valid values for encoding-value ; valid options for host-option-list
See: FILE Statement in SAS Language Reference: Dictionary
FILE file-specification <ENCODING=' encoding-value '> < option-list >< host-option-list >;
file-specification
can be any of the file specification forms discussed in 'Referencing External Files' on page 146.
Note: The words AUX, CON, NUL, PRN, LPT1 - LPT9, and COM1 - COM9 are reserved words under Windows. Do not use them as filenames.
ENCODING=' encoding-value '
specifies the encoding to use when writing to the output file. The value for ENCODING= indicates that the output file has a different encoding from the current session encoding.
When you write data to the output file, SAS transcodes the data from the session encoding to the specified encoding.
For valid encoding values, see 'Encoding Values in SAS Language Elements' in SAS National Language Support (NLS): User 's Guide .
host-option-list
names external I/O statement options that are specific to the Windows operating environment. They can be any of the following:
BLKSIZE= block- size
BLK= block-size
specifies the number of bytes that are physically read or written in an I/O operation. The default is 8K. The maximum is 1M.
BLOCK NOBLOCK
is used only in the context of named pipes. This option indicates whether the client is to wait if no data is currently available. BLOCK is the default value.
BYTE MESSAGE
is used only in the context of named pipes. This option indicates the type of pipe. BYTE is the default value.
COMMAND
is used only in the context of Dynamic Data Exchange (DDE). This option enables you to issue a remote command for applications that do not use the SYSTEM topic name . For more information, see 'Referencing the DDE External File' on page 274 and 'Controlling Another Application Using DDE' on page 276.
EOFCONNECT
is used only in the context of named pipes and is valid only when defining the server. This option indicates that if an end-of-file (EOF) character is received from a client, the server should try to connect to the next client.
HOTLINK
is used only in the context of Dynamic Data Exchange (DDE). For a complete description and an example of using this option, see 'Using the DDE HOTLINK' on page 280.
IGNOREDOSEOF
is used in the context of I/O operations on variable record format files. When this option is specified, any occurrence of ^Z is interpreted as character data and not as an end-of-file marker.
LRECL= record-length
specifies the record length (in bytes). Under Windows, the default is 256. The value of record-length can range from 1 to 1,048,576 (1 megabyte).
MOD
specifies that output should be appended to an existing file.
NOTAB
is used only in the context of Dynamic Data Exchange (DDE). This option enables you to use non-tab character delimiters between variables. For more information about this option, see 'Using the NOTAB Option with DDE' on page 279.
RECFM= record-format
controls the record format. The following values are valid under Windows:
F | indicates fixed format. |
N | indicates binary format and causes the file to be treated as a byte stream. |
P | indicates print format. |
S370V | indicates the variable S370 record format (V). |
S370VB | indicates the variable block S370 record format (VB). |
S370VBS | indicates the variable block with spanned records S370 record format (VBS). |
V D | indicates variable format. This is the default. |
The S370 values are valid with z/OS types of files only. That is, files that are binary, have variable-length records, and are in EBCDIC format. If you want to use a fixed-format z/OS, first copy it to a variable-length, binary z/OS file.
RETRY= seconds
is used only in the context of named pipes. This option specifies how long a named pipe client should wait for a busy pipe. The minimum (and default) value for seconds is 10.
SERVER CLIENT
is used only in the context of named pipes. This option specifies the mode of a named pipe. The default value is SERVER.
TERMSTR=
specifies the end-of-line character for the file. Use this option to share files between the UNIX and Windows operating environments. Valid values are:
CRLF
Carriage return line feed. Use TERMSTR=CRLF to write Windows formatted files. CRLF is the default.
LF
Line feed. Use TERMSTR=LF to write UNIX formatted files.
NL
New line. Use TERMSTR=NL to write UNIX formatted files.
The FILE statement routes the output from the PUT statement to either the same external file to which procedure output is written or to a different external file.
If the FILE statement includes the ENCODING argument and the reserved filerefs LOG or PRINT as the file-specification, SAS issues an error message. The ENCODING value in the FILE statement overrides the value of the ENCODING system option.
'ENCODING System Option' on page 499
'Named Pipe Examples' on page 288 for examples of using some of these options
'DDE Examples' on page 276 for examples of using some of these options
Associates a SAS fileref with an external file or a logical file device
Valid in: anywhere in a SAS program
Windows specifics: Valid values for access-method ; valid values for device-type ; valid filenames for external-file ; valid values for encoding ; valid options in host-option-list
See: FILENAME Statement in SAS Language Reference: Dictionary
FILENAME fileref < device-type >' external-file '
<ENCODING=' encoding-value '>< host-option-list >;
FILENAME fileref device-type <' external-file '>
<ENCODING= encoding-value >< host-option-list >;
FILENAME fileref < device-type > (' directory-1 '<, directory-n '>)
<ENCODING= encoding-value >< host-option-list >;
Note: This is a simplified version of the FILENAME statement syntax. For the complete syntax and its explanation, see the FILENAME statement in SAS Language Reference: Dictionary .
fileref
is any valid fileref, as discussed in 'Using a Fileref' on page 147.
For examples of using filerefs in member-name syntax (also called aggregate syntax), see 'Assigning a Fileref to a Directory' on page 149. For a discussion of the rules SAS uses when accessing files through filerefs, see 'Understanding How Concatenated Directories Are Accessed' on page 153.
Note: The words AUX, CON, NUL, PRN, LPT1 - LPT9, and COM1 - COM9 are reserved words under Windows. Do not use them as filerefs.
device-type
enables you to read and write data from devices rather than files. The following values are valid:
CATALOG
reads a SAS catalog as an external flat file.
COMMPORT
reads data from and writes data to a communications port.
DDE
reads data from and writes data to another application using Dynamic Data Exchange. For more information, see 'DDE Syntax within SAS' on page 273.
DISK
reads data from and writes data to a disk file. Under Windows, DISK is the default for device-type .
DRIVEMAP
displays information about the available hard drives (local and networked).
DUMMY
specifies a null output device. This value is especially useful in testing situations.
lets you send electronic mail programmatically from SAS. For more information, see 'Sending E-Mail Using SAS' on page 40.
FTP
lets you access information on other machines using TCP/IP. You must have TCP/ IP software and a WINSOCK.DLL installed on your local machine. You must also be able to connect to a machine that can function as an FTP server. For more information about using the FTP access method, see the FILENAME statement in SAS Language Reference: Dictionary .
NAMEPIPE
writes data to a named pipe. For more information, see 'Using Named Pipes' on page 286.
NOTESDB
writes data to a Lotus Notes database. For more information, see 'Populating a Lotus Notes Database Using the DATA Step and SCL Code' on page 214.
PIPE
writes data to an unnamed pipe. For more information, see 'Using Unnamed Pipes' on page 284.
PLOTTER
indicates that you are accessing a plotter. Windows printing is not used. This device-type keyword is used solely in conjunction with SAS/GRAPH software.
PRINTER
indicates that you are accessing a printer file or device. By default, output is routed through Windows printing when you use this device-type keyword. For more information about altering your default printer, see the system option 'SYSPRINT System Option' on page 566.
SOCKET
lets you read and write information over a TCP/IP socket. You must have TCP/IP software and a WINSOCK.DLL installed on your local machine. The SOCKET access method uses the nonblocking method of issuing socket requests. For more information about using the SOCKET access method, see the FILENAME statement and FILENAME function in SAS Language Reference: Dictionary .
TEMP
creates a temporary file that exists only as long as the filename is assigned. The temporary file can be accessed only through the logical name and is available only while the logical name exists. A physical path name is never shown to the user. If a physical path name is specified, an error is returned. Files that are manipulated by the TEMP device can have the same attributes and behave identically to DISK files.
For an example of specifying a device type in the FILENAME statement, see 'Advanced External I/O Techniques' on page 160.
Note: The TAPE and TERMINAL device-type keywords (documented in SAS Language Reference: Dictionary ) are not applicable to the Windows operating environment. If you use one of these device-type keywords in your SAS program under Windows, you receive an error message. Also, while the DISK device-type keyword is accepted under Windows, it is ignored because disk files are the default under Windows.
external-file
can be any valid Windows file specification that is enclosed in quotes. (for more information, see 'Referencing External Files' on page 146).
ENCODING=' encoding-value '
specifies the encoding to use when reading from or writing to the external file. The value for ENCODING= indicates that the external file has a different encoding from the current session encoding.
When you read data from an external file, SAS transcodes the data from the specified encoding to the session encoding. When you write data to an external file, SAS transcodes the data from the session encoding to the specified encoding.
For valid encoding values, see 'Encoding Values in SAS Language Elements' in SAS National Language Support (NLS): User's Guide .
host-option-list
names external I/O statement options that are specific to Windows. They can be any of the following:
ALTDEST= filename
is for use only with the PRINTER device type. Filename specifies a file destination to write to when you direct output to the fileref. Although the output is written to disk and not to the printer, the output is still formatted by using the printer driver that is associated with the printer that you specified with the external-file argument. For example,
filename groupHP printer "HP LaserJet 4si, 1st floor" altdest= "C:\My SAS Files\Printer output\out.prn";
uses the printer driver that is associated with the named printer (an HP LaserJet 4si) to create the output in out.prn . No output is actually sent to the printer when you use this fileref.
BAUD=
sets the baud rate. The value for baud-rate depends on your communications hardware. It must be an integer. This host option is valid only if you specify the COMMPORT device-type keyword.
BITS=
sets the transmission bits. Values are 5 through 8. This host option is valid only when you specify the COMMPORT device-type keyword.
Note: For the 8250 serial port, invalid combinations are 5 data bits with 2 stop bits and 6, 7, or 8 data bits with 1.5 stop bits.
BLKSIZE= block-size
BLK= block-size
specifies the number of bytes that are physically read or written in an I/O operation. The default is 8K. The maximum is 1M.
BLOCK NOBLOCK
is used only in the context of named pipes. This option indicates whether the client is to wait if no data is currently available. BLOCK is the default value.
BYTE MESSAGE
is used only in the context of named pipes. This option indicates the type of pipe. BYTE is the default value.
COMMAND
is used only in the context of Dynamic Data Exchange (DDE). This option enables you to issue a remote command for applications that do not use the SYSTEM topic name. For more information, see 'Referencing the DDE External File' on page 274 and 'Controlling Another Application Using DDE' on page 276.
COMTIMEOUT= value
controls how a communications port timeout is handled. A timeout occurs when no data is available at the communications port for a period of time, usually 60 seconds. The COMTIMEOUT= option can have the following values:
EOF | returns an end-of-file (EOF) character when a timeout occurs. This is the default behavior. The EOF character causes the current DATA step to terminate. |
WAIT | instructs the communications port to wait forever for data. In other words, this value overrides the timeout. In this case, no record is returned to the DATA step until data are available. This can cause your program to go into an infinite loop, so use this value with caution. |
ZERO | returns a record length of 0 bytes when a timeout occurs. However, the DATA step does not terminate; it simply tries to read data again. |
This host-option is valid only if you specify the COMMPORT device-type keyword.
CONSOLE= state
specifies the state of the DOS window when an application is opened using pipes. Valid states are:
MAX | opens the DOS window maximized |
MIN | opens the DOS window minimized |
NORMAL | opens the DOS window using the default for the machine. |
This host-option is valid only if you specify the PIPE keyword.
DROPNULL=
is used to discard null bytes when they are received. The valid values are
ON | specifies to discard null bytes when they are received. |
OFF | specifies not to discard null bytes when they are received. OFF is the default value. |
This host option is valid only if you specify the COMMPORT device-type keyword. For example:
filename portin commport 'com1:' dropnull=off;
EOFCONNECT
is used only in the context of named pipes and is valid only when you are defining the server. This option indicates that if an end-of-file (EOF) character is received from a client, the server should try to connect to the next client.
FLOW=
controls the transmission control flow. Values are: XONXOFF, DTRDSR, or RTSCTS. This host option is valid only if you specify the COMMPORT device-type keyword.
HOTLINK
is used only in the context of Dynamic Data Exchange (DDE). For a complete description and an example of how to use this option, see 'Using the DDE HOTLINK' on page 280.
IGNOREDOSEOF
is used in the context of I/O operations on variable record format files. When this option is specified, any occurrence of ^Z is interpreted as character data and not as an end-of-file marker.
LRECL= record-length
specifies the record length (in bytes). Under Windows, the default is 256. The value of record-length can range from 1 to 1,048,576 (1 megabyte).
MOD
specifies that output should be appended to an existing file.
NOTAB
is used only in the context of Dynamic Data Exchange (DDE). This option enables you to use nontab character delimiters between variables. For more information about this option, see 'Using the NOTAB Option with DDE' on page 279.
PARITY=
sets the parity check bit. Values are NONE, ODD, EVEN, MARK, or SPACE. This host option is valid only if you specify the COMMPORT device-type keyword.
RECFM= record-format
controls the record format. The following values are valid under Windows:
F | indicates fixed format. |
N | indicates binary format and causes the file to be treated as a byte stream. N is not valid for the PIPE or the NAMEPIPE device types. |
P | indicates print format. |
S370V | indicates the variable S370 record format (V). |
S370VB | indicates the variable block S370 record format (VB). |
S370VBS | indicates the variable block with spanned records S370 record format (VBS). |
V D | indicates variable format. This is the default. |
The S370 values are valid with z/OS types of files only. That is, files that are binary, have variable-length records, and are in EBCDIC format. If you want to use a fixed-format z/OS file, first copy it to a variable-length, binary z/OS file.
RETRY= seconds
is used only in the context of named pipes. This option specifies how long a named pipe client should wait for a busy pipe. The minimum (and default) value for seconds is 10.
RCONST= seconds
specifies the initial read time-out value in 0.001 of a second (1000 = 1 second). The default is 8 seconds. This host-option is valid only if you specify the COMMPORT device-type keyword.
RMULTI= seconds
specifies the subsequent read time-out value in 0.001 of a second (1000 = 1 second). This host-option is valid only if you specify the COMMPORT device-type keyword.
SERVER CLIENT
is used only in the context of named pipes. This option specifies the mode of a named pipe. The default value is SERVER.
STOP=
sets the stop bit. Values are ONE, TWO, ONEHALF. This host option is valid only if you specify the COMMPORT device-type keyword.
Note: For the 8250 serial port, invalid combinations are 5 data bits with 2 stop bits and 6, 7, or 8 data bits with 1.5 stop bits.
WCONST= seconds
specifies the initial time-out value in 0.001 of a second (1000 = 1 second). This host option is valid only if you specify the COMMPORT device-type keyword.
WMULTI= seconds
specifies the subsequent time-out value in 0.001 of a second (1000 = 1 second). This host option is valid only if you specify the COMMPORT device-type keyword.
The FILENAME statement temporarily associates a valid SAS name with an external file or an output device. An external file is a file created and maintained in the Windows operating environment from which you need to read data.
Operating Environment Information: Under Windows NT, when the FILENAME statement is issued and the Start in field of the SAS properties Shortcut page is blank, Windows adds a shortcut for the FILEREF to the desktop. To avoid this, be sure that the Start in field is not blank.
'Advanced External I/O Techniques' on page 160
Prints up to ten lines of text at the bottom of the procedure output
Valid in: anywhere in a SAS program
Windows specifics: Maximum length of footnote
See: FOOTNOTE Statement in SAS Language Reference: Dictionary
FOOTNOTE < n > <' text ' ' text '>;
n
specifies the relative line to be occupied by the footnote.
text
specifies the text of the footnote in single or double quotation marks.
The FOOTNOTE statement takes effect when the step or RUN group with which it is associated executes. Once you specify a footnote for a line, SAS repeats the same footnote on all pages until you cancel or redefine the footnote for that line.
The maximum footnote length under Windows is 256 characters . If the specified footnote is greater than the LINESIZE system option, the footnote is truncated to the line size.
Includes and executes SAS statements and data lines
Valid in: anywhere in a SAS program
Windows specifics: source , if a file specification is used; valid options for encoding-value and host-options
See: %INCLUDE Statement in SAS Language Reference: Dictionary
%INCLUDE source </<ENCODING=' encoding-value '>< host-options >>;
Note: This is a simplified version of the %INCLUDE statement syntax. For the complete syntax and its explanation, see the %INCLUDE statement in SAS Language Reference: Dictionary .
source
describes the location of the information you want to access. The two possible sources are a file specification or internal lines. Under Windows, an asterisk (*) cannot be used to specify keyboard entry. The file specification can be any of the file specification forms discussed in 'Referencing External Files' on page 146.
Note: When using member-name syntax and the member name contains a leading digit, enclose the member name in quotation marks. If the member name contains a macro variable reference, use double quotation marks.
ENCODING=' encoding-value '
specifies the encoding to use when reading from the specified source. The value for ENCODING= indicates that the specified source has a different encoding from the current session encoding.
When you read data from the specified source, SAS transcodes the data from the specified encoding to the session encoding.
For valid encoding values, see 'Encoding Values in SAS Language Elements' in SAS National Language Support (NLS): User's Guide .
host-options
consists of statement options that are valid under Windows. Remember to precede the options list with a forward slash (/). The following options are available under Windows:
BLKSIZE= block-size
BLK= block-size
specifies the number of bytes that are physically read or written in an I/O operation. The default is 8K. The maximum is 1M.
BLOCK NOBLOCK
is used only in the context of named pipes. This option indicates whether the client is to wait if no data is currently available.
BYTE MESSAGE
is used only in the context of named pipes. This option indicates the type of pipe; BYTE is the default value.
EOFCONNECT
is used only in the context of named pipes and is valid only when defining the server. This option indicates that the server should try to connect to the next client if an end-of-file (EOF) character is received from a client.
IGNOREDOSEOF
is used in the context of I/O operations on variable record format files. When this option is specified, any occurrence of ^Z is interpreted as character data and not as an end-of-file marker.
LRECL= record-length
specifies the record length (in bytes). Under Windows, the default is 256. The value of record-length can range from 1 to 1,048,576 (1 megabyte).
NOTAB
is used only in the context of Dynamic Data Exchange. This option enables you to use non-tab character delimiters between variables. For more information about this option, see 'Using the NOTAB Option with DDE' on page 279
RECFM= record-format
controls the record format. The following values are valid under Windows:
F | indicates fixed format. |
N | indicates binary format and causes the file to be treated as a byte stream. |
P | indicates print format. |
S370V | indicates the variable S370 record format (V). |
S370VB | indicates the variable block S370 record format (VB). |
S370VBS | indicates the variable block with spanned records S370 record format (VBS). |
VD | indicates variable format. This is the default. |
The S370 values are valid with files laid out as z/OS files only-that is, files that are binary, have variable-length records, and are in EBCDIC format. If you want to use a fixed-format z/OS file, first copy it to a variable-length, binary z/OS file.
When you execute a program that contains the %INCLUDE statement, SAS executes your code, including any statements or data lines that you bring into the program with %INCLUDE.
Specifies an external file to read with an INPUT statement
Valid in: a DATA step
Windows specifics: Valid values for encoding-value , file-specification , and host-options
See: INFILE Statement in SAS Language Reference: Dictionary
INFILE file-specification <ENCODING=' encoding-value '>< options > < host-options >;
file-specification
identifies the source of input data records, usually an external file. The file-specification argument can be any of the file specification forms that are discussed in 'Referencing External Files' on page 146. The reserved fileref CARDS enables the INFILE statement to reference instream data.
Note: The words AUX, CON, NUL, PRN, LPT1 - LPT9, and COM1 - COM9 are reserved words under Windows. Do not use them as filerefs.
ENCODING=' encoding-value '
specifies the encoding to use when reading from the external file. The value for ENCODING= indicates that the external file has a different encoding from the current session encoding.
When you read data from an external file, SAS transcodes the data from the specified encoding to the session encoding.
For valid encoding values, see 'Encoding Values in SAS Language Elements' in SAS National Language Support (NLS): User's Guide .
host-options
names external I/O statement options that are specific to the Windows operating environment. They can be any of the following:
BLKSIZE= block-size
BLK= block-size
specifies the number of bytes that are physically read or written in an I/O operation. The default is 8K. The maximum is 1M.
BLOCK NOBLOCK
is used only in the context of named pipes. This option indicates whether the client is to wait if no data is currently available. The default value is BLOCK.
BYTE MESSAGE
is used only in the context of named pipes. This option indicates the type of pipe. The default value is BYTE.
EOFCONNECT
is used only in the context of named pipes and is valid only when defining the server. This option indicates that if an end-of-file (EOF) character is received from a client, the server should try to connect to the next client.
HOTLINK
is used only in the context of Dynamic Data Exchange (DDE). For a complete description and an example of using this option, see 'Using the DDE HOTLINK' on page 280.
IGNOREDOSEOF
is used in the context of I/O operations on variable record format files. When this option is specified, any occurrence of ^Z is interpreted as character data and not as an end-of-file marker.
LRECL= record-length
specifies the record length (in bytes). Under Windows, the default is 256. The value of record-length can range from 1 to 1,048,576 (1 megabyte).
NOTAB
is used only in the context of Dynamic Data Exchange (DDE). This option enables you to use nontab character delimiters between variables. For more information about this option, see 'Using the NOTAB Option with DDE' on page 279.
RECFM= record-format
controls the record format. The following are valid values under Windows:
F | indicates fixed format. |
N | indicates binary format and causes the file to be treated as a byte stream. |
P | indicates print format. |
S370V | indicates the variable S370 record format (V). |
S370VB | indicates the variable block S370 record format (VB). |
S370VBS | indicates the variable block with spanned records S370 record format (VBS). |
V D | indicates variable format. This is the default. |
The S370 values are valid with z/OS types of files only. That is, they are valid in files that are binary, have variable-length records, and are in EBCDIC format. If you want to use a fixed-format z/OS file, first copy it to a variable-length, binary z/OS file.
RETRY= seconds
is used only in the context of named pipes. This option specifies how long a named pipe client should wait for a busy pipe. The minimum (and default) value for seconds is 10.
SERVER CLIENT
is used only in the context of named pipes. This option specifies the mode of a named pipe. The default value is SERVER.
TERMSTR=
specifies the end-of-line character for the file. Use this option to share files between the UNIX and Windows operating environments. Valid values are:
CRLF
Carriage return line feed. Use TERMSTR=CRLF to read Windows formatted files. CRLF is the default.
LF
Line feed. Use TERMSTR=LF to read UNIX formatted files.
NL
New line. Use TERMSTR=NL to read UNIX formatted files.
If the INFILE statement includes the ENCODING argument and CARDS, CARDS4, DATALINES, or DATALINES4 as the file-specification, then SAS issues an error message. The ENCODING value in the INFILE statement overrides the value of the ENCODING system option.
'ENCODING System Option' on page 499
'Named Pipe Examples' on page 288 for examples of using some of these options
'DDE Examples' on page 276 for examples of using some of these options.
Specifies the number of bytes SAS uses to store numeric variables
Valid in: a DATA step
Windows specifics: Valid numeric variable lengths; valid values for length ; valid values for n
See: LENGTH Statement in SAS Language Reference: Dictionary
LENGTH < variable-1 >< variable-n > <$> < length > <DEFAULT= n >;
length
Under Windows, can range from 3 to 8 bytes for numeric variables.
DEFAULT= n
changes the default number of bytes used for storing the values of newly created numeric variables from 8 to the value of n . Under Windows, the value of n can range from 3 to 8 bytes.
The LENGTH statement specifies the number of bytes SAS is to use for storing values of variables in each data set being created.
CAUTION:
Any length less than 8 bytes may result in a loss of precision for the value of the variable.
'Length and Precision of Variables under Windows' on page 579
Associates a libref with a SAS data library and lists file attributes for a SAS data library
Valid in: anywhere in a SAS program
Windows specifics: Valid values for engine ; specifications for SAS-data-library
See: LIBNAME Statement in SAS Language Reference: Dictionary
LIBNAME libref < engine >'(' SAS-data-library-1 ' <, ' SAS-data-library-n '> )'
<MEMLIB>;
LIBNAME libref _ALL_ LIST;
LIBNAME libref _ALL_ CLEAR;
Note: This is a simplified version of the LIBNAME statement syntax. For the complete syntax and its explanation, see the LIBNAME statement in SAS Language Reference: Dictionary .
libref
is any valid libref, as documented in SAS Language Reference: Dictionary .
engine-name
is one of the following library engines supported under Windows:
V9 | accesses SAS System 9 and SAS 9.1 data sets. You can use the nickname BASE for this engine. |
V8 | accesses Version 8, Release 8.1, and Release 8.2 data sets. |
V7 | accesses Version 7 data sets. |
V6 | accesses Release 6.08 through Release 6.12 data sets. |
V604 | accesses Release 6.03 and Release 6.04 data sets. |
XML | generates an XML document from a SAS data set. |
XPORT | accesses transport format files. |
BMDP | accesses BMDP data files in a 32-bit operating environment. |
OSIRIS | accesses OSIRIS data files. |
SPSS | accesses SPSS system files. |
For more information about these engines, see 'Multiple Engine Architecture' on page 122 and the discussion of engines in SAS Language Reference: Dictionary .
SAS-data-library
is the physical name of a SAS data library under Windows. It must be a valid Windows pathname or an environment variable that is set to a valid Windows pathname. You can concatenate several Windows directories to serve as a single SAS data library. When you specify multiple libraries, use parentheses around the first and last library pathnames. For more information about concatenated SAS data libraries, see 'Understanding How Multi-Folder SAS Data Libraries Are Accessed' on page 131.
MEMLIB
specifies to use extended server memory for this library. For more information about using extended memory, see 'Memory-Based Libraries' on page 199.
The LIBNAME statement associates a libref with a permanent SAS data library. It also can be used to list the file attributes of a SAS data library. (The LIBNAME statement is also used to clear a libref. For more information, see 'Clearing Librefs' on page 130.)
Note: The words AUX, CON, NUL, PRN, LPT1 - LPT9, and COM1 - COM9 are reserved words under Windows. Do not use them as librefs.
Associating Librefs Use one of the following forms of the LIBNAME statement to associate a libref or an engine with a SAS data library:
LIBNAME libref < engine > ' SAS-data-library '
LIBNAME libref < engine > (' SAS-data-library-1 ' <, ' SAS-data-library-n ')>;
Use quotation marks when SAS-data-library is a physical path. Quotation marks are not needed when you concatenate librefs.
You can use the same arguments with these forms of the LIBNAME statement as shown in the LIBNAME statement syntax.
Listing Data Library Attributes With the LIST option, you can use the LIBNAME statement to list attributes of SAS data libraries. Output 21.1 shows the results of the following LIBNAME statement:
libname sashelp list;
5 libname sashelp list; 1 libname sashelp list; NOTE: Libref= SASHELP Scope= Kernel Levels= 27 -Level 1- Engine= V9 Physical Name= C:\Program Files\SAS\SAS 9.1\nls\en\SASCFG File Name= C:\Program Files\SAS\SAS 9.1\nls\en\SASCFG -Level 2- Engine= V9 Physical Name= C:\Program Files\SAS\SAS 9.1\core\sashelp File Name= C:\Program Files\SAS\SAS 9.1\core\sashelp . . . -Level 27- Engine= V9 Physical Name= C:\Program Files\SAS\SAS 9.1\webhound\sashelp File Name= C:\Program Files\SAS\SAS 9.1\webhound\sashelp 2 run;
'LIBNAME Statement' in SAS Output Delivery System: User's Guide
'LIBNAME Statement' in SAS Metadata LIBNAME Engine User's Guide
'LIBNAME Statement' in SAS XML LIBNAME Engine User's Guide
'LIBNAME Statement' in SAS/ACCESS for Relational Databases: Reference
'Using Data Libraries' on page 125
Executes, lists, or terminates asynchronous tasks
Valid in: anywhere in a SAS program
Windows specifics: all
SYSTASK COMMAND " operating system-command "
<WAIT NOWAIT>
<TASKNAME= taskname >
<MNAME= name-var >
<STATUS= stat-var >
<SHELL<=" shell-command ">>;
SYSTASK LIST <_ALL_ taskname > <STATE> <STATVAR>;
SYSTASK KILL taskname < taskname ...>;
COMMAND
executes the operating system-command
LIST
lists either a specific active task or all of the active tasks in the system.
KILL
forces the termination of the specified task(s).
operating system command
specifies the name of a Windows command (including any command-specific options). Enclose the command in either single or double quotation marks. If the command options require quotes, repeat the quotes. For example:
systask command "find ""my text"" c:\mydir\myfile.sas"
Note: The operating system command that you specify cannot require input from the keyboard.
WAIT NOWAIT
determines whether SYSTASK COMMAND suspends execution of the current SAS session until the task has completed. NOWAIT is the default. For tasks that are started with the NOWAIT argument, you can use the WAITFOR statement when necessary to suspend execution of the SAS session until the task has finished.
TASKNAME= taskname
specifies a name that identifies the task. Task names must be unique among all active tasks. A task is active if it is running, or if it has completed and has not been waited for using the WAITFOR statement. Duplicate task names generate an error in the SAS log. If you do not specify a task name, SYSTASK will automatically generate a name. If the task name contains a blank character, enclose the task name in quotes.
MNAME= name-var
specifies a macro variable in which you want SYSTASK to store the task name that it automatically generated for the task. If you specify both the TASKNAME option and the MNAME option, SYSTASK copies the name you specified with TASKNAME into the variable that you specified with MNAME.
STATUS= stat-var
specifies a macro variable in which you want SYSTASK to store the status of the task. Status variable names must be unique among all active tasks.
SHELL<=" shell-command ">
specifies that the operating system-command should be executed with the operating system shell command. If you specify a shell-command, SYSTASK uses the shell command that you specify to invoke the shell; otherwise , SYSTASK uses the default shell. Enclose the shell command in quotes.
_ALL_
specifies all active tasks in the system.
STATE
specifies to display the status of the task, which can be Start Failed, Running, or Complete.
STATVAR
specifies to display the status variable associated with the task. The status variable is the variable that you assigned with the STATUS option in the SYSTASK COMMAND statement.
SYSTASK allows you to execute operating system-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 copy a SAS program, you might use this statement:
systask command "copy myprog.sas myprog1.sas" taskname="copyfile" status=copystat;
The return code from the copy command is saved in the macro variable COPYSTAT.
Note: Windows command output is not written to the SAS log.
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 tasks that can be run with SYSTASK:
Task
All tasks started with SYSTASK COMMAND are of type Task. For these tasks, if you do not specify STATVAR or STATE, then SYSTASK LIST displays the task name, type, and state, and the name of the status macro variable. To terminate tasks of type Task, use SYSTASK KILL.
SAS/Connect Process
Tasks started from SAS/Connect with the SIGNON statement or command, and RSUBMIT statement are of type SAS/Connect Process. To display SAS/Connect processes, use the LISTTASK statement to display the task name, type, and state. To terminate a SAS/Connect process, use the KILLTASK statement. For information on SAS/Connect processes, see SAS/CONNECT User's Guide .
Note: The preferred method for displaying any task (not just SAS/Connect processes) is to use the LISTTASK statement instead of SYSTASK LIST.
The preferred method for ending a task is using the KILLTASK statement in place of SYSTASK KILL.
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 may be insufficient resources to complete a task, or the SYSTASK statement may contain syntax errors. With the SYSTASK KILL statement, if one or more of the processes cannot be terminated , 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. See WAITFOR for more information about the status variables.
Unlike the X statement, you cannot use the SYSTASK statement to start a new interactive session.
'WAITFOR Statement' on page 461
'X Statement' on page 462
Specifies title lines for SAS output
Valid in: anywhere in a SAS program
Windows specifics: Maximum length of the title
See: TITLE Statement in SAS Language Reference: Dictionary
TITLE < n > <' text ' ' text '>;
n
specifies the relative line that contains the title line.
' text ' ' text '
specifies text that is enclosed in single or double quotation marks.
The TITLE statement specifies title lines to be printed on SAS print files and other SAS output. A TITLE statement takes effect when the DATA or PROC step or RUN group with which it is associated executes. Once you specify a title for a line, it is used for all subsequent output until you cancel the title or define another title for that line.
Under Windows, the maximum title length is 256 characters. If the specified title is greater than the LINESIZE system option, the title is truncated to the line size.
Suspends execution of the current SAS session until the specified tasks finish executing
Valid in: anywhere in a SAS program
Windows specifics: all
WAITFOR<_ANY_ _ALL_> taskname < taskname ...><TIMEOUT= seconds >;
taskname
specifies the name of the task(s) that you want to wait for. See 'SYSTASK Statement' on page 458 for information about task names. The task name(s) that you specify must match exactly the task names assigned through the SYSTASK COMMAND statement. You cannot use wildcards to specify task names.
_ANY_ _ALL_
suspends execution of the current SAS session until either one or all of the specified tasks finishes executing. The default setting is _ANY_, which means that as soon as one of the specified task(s) completes executing, the WAITFOR statement will finish executing.
TIMEOUT= seconds
specifies the maximum number of seconds that WAITFOR should suspend the current SAS session. If you do not specify the TIMEOUT option, WAITFOR will suspend execution of the SAS session indefinitely.
The WAITFOR statement 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 XWAIT option, then the WAITFOR statement ignores that task.
For example, 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;
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
you specify a single task that does not finish executing
you specify more than one task and the _ANY_ option (which is the default setting), but none of the tasks finishes executing
you specify more than one task and the _ALL_ option, and any one of the tasks does not finish executing.
Any task whose status variable is still NULL after the WAITFOR statement has executed did not complete execution.
'SYSTASK Statement' on page 458
'X Statement' on page 462
'XWAIT System Option' on page 577
Runs an operating system command or a Windows application from within a SAS session
Valid in: anywhere in a SAS program
Windows specifics: Valid values for command
See: X Statement in SAS Language Reference: Dictionary
X <' command '>;
no argument
places you in a Command prompt session, with an operating system prompt. Here you can execute Windows commands in the context of SAS working directory. There are some things that you cannot do from the Command prompt in this situation, such as define environment variables for use by your SAS session. (Environment variables must be defined before you invoke SAS). Type EXIT at the Command prompt and press ENTER to return to your SAS session.
command
specifies a Windows command or a Windows application. This argument can be anything you can specify at a DOS prompt (including the SAS command). Therefore, you can use the X statement to execute Windows applications. The command can be enclosed in quotes, but this is not required syntax.
The command is passed to Windows and executed in the context of the working directory. If errors occur, the appropriate error messages are displayed.
By default, you must type EXIT to return to your SAS session after the command has completed execution. Also by default, if you execute a Windows application such as Notepad, you must close the application before you can return to your SAS session. Specify NOXWAIT in an OPTIONS statement if you do not want to have to type EXIT. With NOXWAIT in effect, as soon as the command finishes execution, control is returned to your SAS session. Note, however, that if you execute a Windows application with the X statement, specifying NOXWAIT does not let you return to your SAS session until you close the application.
Another system option, XSYNC, controls whether you have to wait for the command to finish executing before you can return to your SAS session. If you specify NOXSYNC, you can start a Windows application with the X statement and return to your SAS session without closing the application. For additional details about these two system options, see 'XWAIT System Option' on page 577 and 'XSYNC System Option' on page 576.
The X statement issues a host command from within a SAS session when you run SAS in windowing mode. SAS executes the X statement immediately.
Under Windows, you can issue the X statement without the command argument.
There are other ways of running operating environment commands besides the X statement (and the X command) under Windows.
'X Command' on page 372
'XSYNC System Option' on page 576
'XWAIT System Option' on page 577
'CALL SYSTEM Routine' on page 387
The %SYSEXEC statement in 'Macro Statements' on page 583
'Running Windows or MS-DOS Commands from within SAS' on page 25
'Adding Applications to the Tools Menu' on page 64