1.

What is the meaning of STOP and OUTPUT statements in SAS?

Answer»
  • STOP STATEMENT: Using STOP, SAS immediately stops processing the current DATA step and resumes processing statements after the current DATA step ends. In other words, the STOP statement halts the execution of all statements containing it, including DO statements and looping statements.

Syntax:  STOP;

Example: As demonstrated in this example, STOP is used to avoid an infinite loop when using a random access method within a DATA step: 

data sample; do developerobs=1 to engineeringobs by 10; set master.research point=developerobs nobs=engineeringobs; output; END; stop; run;
  • OUTPUT Statement: Output tells SAS to write the current observation immediately to a SAS data set, not at the end of the DATA step. The current observation will be written to all data sets NAMED in the DATA statement if there is no data set name specified in the OUTPUT statement.

Syntax: OUTPUT <data-set-name(s)>;

Example: Each line of INPUT data can be used to CREATE two or more observations. As given below, for each observation in the data set Scaler, three observations are created in the SAS data set Result. 

data Result(drop=time4-time6); set Scaler; time=time4; output; time=time5; output; time=time6; output; run;


Discussion

No Comment Found