Changes the value of one or more SAS system options
Category: Program Control
See: OPTIONS Statement in the documentation for your operating environment.
OPTIONS option(s) ;
specifies one or more SAS system options to be changed.
The change that is made by the OPTIONS statement remains in effect for the rest of the job, session, SAS process, or until you issue another OPTIONS statement to change the options again. You can specify SAS system options through the OPTIONS statement, through the OPTIONS window, at SAS invocation, and at the initiation of a SAS process.
If you want a particular
An OPTIONS statement can appear at any place in a SAS program, except within data lines.
Operating Environment Information: The system options that are available depend on your operating environment. Also, the syntax that is used to specify a system option in the OPTIONS statement may be different from the syntax that is used at SAS invocation. For details, see the SAS documentation for your operating environment.
The OPTIONS statement requires you to enter the complete statement including system option
This example suppresses the date that is normally written to SAS output and sets a line
options nodate linesize=72;
Definition of System Options on page 1441
Valid: in a DATA step
Using OUTPUT without arguments causes the current observation to be written to all data sets that are named in the DATA statement.
Note: If a MODIFY statement is present, OUTPUT with no arguments writes the current observation to the end of the data set that is specified in the MODIFY statement.
specifies the name of a data set to which SAS writes the observation.
Tip: You can specify up to as many data sets in the OUTPUT statement as you specified in the DATA statement for that DATA step.
When and Where the OUTPUT Statement Writes Observations
The OUTPUT statement
Implicit versus Explicit Output
By default, every DATA step contains an implicit OUTPUT statement at the end of each iteration that tells SAS to write observations to the data set or data sets that are being created. Placing an explicit OUTPUT statement in a DATA step
When Using the MODIFY Statement When you use the MODIFY statement with the OUTPUT statement, the REMOVE and REPLACE statements override the implicit write action at the end of each DATA step iteration. See Comparisons on page 1340 for more information. If both the OUTPUT statement and a REPLACE or REMOVE statement execute on a given observation, perform the output action last to keep the position of the observation pointer correct.
OUTPUT writes observations to a SAS data set; PUT writes variable values or text strings to an external file or the SAS log.
To control when an observation is written to a specified output data set, use the OUTPUT statement. To control which
When you use the OUTPUT statement with the MODIFY statement, the following items apply.
Using an OUTPUT, REPLACE, or REMOVE statement overrides the default write action at the end of a DATA step. (OUTPUT is the default action; REPLACE becomes the default action when a MODIFY statement is used.) If you use any of these statements in a DATA step, you must explicitly program output for the new observations that are added to the data set.
The OUTPUT, REPLACE, and REMOVE statements are independent of each other. More than one statement can apply to the same observation, as long as the sequence is logical.
If both an OUTPUT and a REPLACE or REMOVE statement execute on a given observation, perform the OUTPUT action last to keep the position of the observation pointer correct.
These examples show how you can use an OUTPUT statement:
This line of code writes the current observation to a SAS data set.
This line of code writes the current observation to a SAS data set when a specified condition is true.
if deptcode gt 2000 then output;
This line of code writes an observation to the data set MARKUP when the PHONE value is missing.
if phone=. then output markup;
You can create two or more observations from each line of input data. This SAS program creates three observations in the data set RESPONSE for each observation in the data set SULFA:
data response(drop=time1-time3); set sulfa; time=time1; output; time=time2; output; time=time3; output; run;
You can create more than one SAS data set from one input file. In this example, OUTPUT writes observations to two data sets, OZONE and OXIDES:
options yearcutoff= 1920; data ozone oxides; infile file-specification ; input city $ 1-15 date date9. chemical $ 26-27 ppm 29-30; if chemical='O3' then output ozone; else output oxides; run;
You can combine several input observations into one observation. In this example, OUTPUT creates one observation that totals the values of DEFECTS in the first ten observations of the input data set:
data discards; set gadgets; drop defects; reps+1; if reps=1 then total=0; total+defects; if reps=10 then do; output; stop; end; run;
DATA Statement on page 1124
MODIFY Statement on page 1307
PUT Statement on page 1342
REMOVE Statement on page 1375
REPLACE Statement on page 1378