Chapter Contents

Previous

Next
SAS Language Reference: Dictionary

Global Statements


Definition

Global statements generally provide information to SAS, request information or data, move between different modes of execution, or set values for system options. Other global statements (ODS statements) deliver output in a variety of formats, such as in Hypertext Markup Language (HTML). You can use global statements anywhere in a SAS program. Global statements are not executable; they take effect as soon as SAS compiles program statements.

Other SAS software products have additional global statements that are used with those products. For information, see the SAS documentation for those products.


Global Statements by Category

The following table lists and describes SAS global statements, organized by function into five categories:

Global Statements by Category
Statements in this category ... let you ...
DATA ACCESS associate reference names with SAS data libraries, SAS catalogs, external files and output devices, and access remote files.
OPERATING ENVIRONMENT access the operating environment directly.
LOG CONTROL alter the appearance of the SAS log.
OUTPUT CONTROL add titles and footnotes to your SAS output; deliver output in a variety of formats.
PROGRAM CONTROL govern the way SAS processes your SAS program.
WINDOW DISPLAY display and customize windows.

The following table provides brief descriptions of SAS global statements. For more detailed information, see the individual statements.

Categories and Descriptions of DATA Step Statements
Category Statement Description
Action ABORT
Stops executing the current DATA step, SAS job, or SAS session

Assignment
Evaluates an expression and stores the result in a variable

CALL
Invokes or calls a SAS CALL routine

DELETE
Stops processing the current observation

DESCRIBE
Retrieves source code from a stored compiled DATA step program or a DATA step view

ERROR
Sets _ERROR_ to 1 and, optionally, writes a message to the SAS log

EXECUTE
Executes a stored compiled DATA step program

IF, Subsetting
Continues processing only those observations that meet the condition

LIST
Writes to the SAS log the input data records for the observation that is being processed

LOSTCARD
Resynchronizes the input data when SAS encounters a missing or invalid record in data that have multiple records per observation

Null
Signals the end of data lines; acts as a placeholder

OUTPUT
Writes the current observation to a SAS data set

REDIRECT
Points to different input or output SAS data sets when you execute a stored program

REMOVE
Deletes an observation from a SAS data set

REPLACE
Replaces an observation in the same location

STOP
Stops execution of the current DATA step

Sum
Adds the result of an expression to an accumulator variable

WHERE
Selects observations from SAS data sets that meet a particular condition
Control CONTINUE
Stops processing the current DO-loop iteration and resumes with the next iteration

DO
Designates a group of statements to be executed as a unit

DO, Iterative
Executes statements between DO and END repetitively based on the value of an index variable

DO UNTIL
Executes statements in a DO loop repetitively until a condition is true

DO WHILE
Executes statements repetitively while a condition is true

END
Ends a DO group or a SELECT group

GO TO
Moves execution immediately to the statement label that is specified

IF-THEN/ELSE
Executes a SAS statement for observations that meet specific conditions

Labels, Statement
Identifies a statement that is referred to by another statement

LEAVE
Stops processing the current loop and resumes with the next statement in sequence

LINK
Jumps to a statement label

RETURN
Stops executing statements at the current point in the DATA step and returns to a predetermined point in the step

SELECT
Executes one of several statements or groups of statements
File-handling BY
Controls the operation of a SET, MERGE, MODIFY, or UPDATE statement in the DATA step and sets up special grouping variables

CARDS
Indicates that data lines follow

CARDS4
Indicates that data lines that contain semicolons follow

DATA
Begins a DATA step and provides names for any output SAS data sets

DATALINES
Indicates that data lines follow

DATALINES4
Indicates that data lines that contain semicolons follow

FILE
Specifies the current output file for PUT statements

FILE, ODS
Defines the structure of the data component that holds the results of the DATA step and binds that component to a template to produce an output object. ODS sends this object to all open ODS destinations, each of which formats the object appropriately. Also controls what happens when the PUT statement tries to write past the end of a line.

INFILE
Identifies an external file to read with an INPUT statement

INPUT
Describes the arrangement of values in the input data record and assigns input values to the corresponding SAS variables

INPUT, Column
Reads input values from specified columns and assigns them to the corresponding SAS variables

INPUT, Formatted
Reads input values with specified informats and assigns them to the corresponding SAS variables

INPUT, List
Scans the input data record for input values and assigns them to the corresponding SAS variables

INPUT, Named
Reads data values that appear after a variable name that is followed by an equal sign and assigns them to corresponding SAS variables

MERGE
Joins observations from two or more SAS data sets into single observations

MODIFY
Replaces, deletes, and appends observations in an existing SAS data set in place; does not create an additional copy

PUT
Writes lines to the SAS log, to the SAS procedure output file, or to an external file that is specified in the most recent FILE statement

PUT, Column
Writes variable values in the specified columns in the output line

PUT, Formatted
Writes variable values with the specified format in the output line

PUT, List
Writes variable values and the specified character strings in the output line

PUT, Named
Writes variable values after the variable name and an equal sign

PUT, _ODS_
Writes data values to a special buffer from which they can be written to the data component, and formatted by ODS destinations

SET
Reads an observation from one or more SAS data sets

UPDATE
Updates a master file by applying transactions
Information ARRAY
Defines elements of an array

Array Reference
Describes the elements in an array to be processed

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

DROP
Excludes variables from output SAS data sets

FORMAT
Associates formats with variables

INFORMAT
Associates informats with variables

KEEP
Includes variables in output SAS data sets

LABEL
Assigns descriptive labels to variables

LENGTH
Specifies the number of bytes for storing variables

MISSING
Assigns characters in your input data to represent special missing values for numeric data

RENAME
Specifies new names for variables in output SAS data sets

RETAIN
Causes a variable that is created by an INPUT or assignment statement to retain its value from one iteration of the DATA step to the next

Categories and Descriptions of Global Statements
Category Statement Description
Data Access CATNAME
Logically combines two or more catalogs into one by associating them with a catref (a shortcut name); clears one or all catrefs; lists the concatenated catalogs in one concatenation or in all concatenations

FILENAME
Associates a SAS fileref with an external file or an output device; disassociates a fileref and external file; lists attributes of external files

FILENAME, CATALOG Access Method
References a SAS catalog as an external file

FILENAME, FTP Access Method
Allows you to access remote files using the FTP protocol

FILENAME, SOCKET Access Method
Allows you to read from or write to a TCP/IP socket

FILENAME, URL Access Method
Allows you to access remote files using the URL access method

LIBNAME
Associates or disassociates a SAS data library with a libref (a shortcut name); clears one or all librefs; lists the characteristics of a SAS data library; concatenates SAS data libraries; implicitly concatenates SAS catalogs.

LIBNAME, SAS/ACCESS
Associates a SAS libref with a database management system (DBMS) database, schema, server, or group of tables or views
Log Control Comment
Documents the purpose of the statement or program

PAGE
Skips to a new page in the SAS log

SKIP
Creates a blank line in the SAS log
Operating Environment X
Issues an operating-environment command from within a SAS session
Output Control FOOTNOTE
Prints up to ten lines of text at the bottom of the procedure or DATA step output

ODS EXCLUDE
Specifies output objects to exclude from ODS destinations

ODS HTML
Opens, manages, or closes the HTML destination. If the destination is open, you can create HTML output (output that is written in Hypertext Markup Language).

ODS LISTING
Opens, manages, or closes the Listing destination

ODS OUTPUT
Creates a SAS data set from an output object and manages the selection and exclusion lists for the Output destination

ODS PATH
Specifies which locations to search for definitions that were created by PROC EMPLATE, as well as the order in which to search for them

ODS PRINTER
Opens, manages, or closes the Printer destination. If the destination is open, you can create Printer output (output that is formatted for a high-resolution printer)

ODS SELECT
Specifies output objects for ODS destinations

ODS SHOW
Writes to the SAS log the specified selection or exclusion list

ODS TRACE
Writes to the SAS log a record of each output object that is created, or suppresses the writing of this record

ODS VERIFY
Prints or suppresses a warning that a style definition or a table definition that is used is not supplied by SAS Institute

TITLE
Specifies title lines for SAS output
Program Control DM
Submits SAS Program Editor, Log, Procedure Output or text editor commands as SAS statements

ENDSAS
Terminates a SAS job or session after the current DATA or PROC step executes

%INCLUDE
Brings a SAS programming statement, data lines, or both, into a current SAS program

%LIST
Displays lines that are entered in the current session

OPTIONS
Changes the value of one or more SAS system options

RUN
Executes the previously entered SAS statements

%RUN
Ends source statements following a %INCLUDE * statement
Window Display DISPLAY
Displays a window that is created with the WINDOW statement

WINDOW
Creates customized windows for your applications


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.