DATA Step, Macro, Functions and more

Output in Data Step

Reply
Regular Contributor
Posts: 173

Output in Data Step

Hello,

The code below comes from a data step. Can someone tell me what the 'output' does?

IF STAFFID1 ¬= ' ' THEN DO;
CNTL = ENTITYID||STAFFID1;
STAFF = STAFFID1; OUTPUT; END;


Thank you so much!
SAS Super FREQ
Posts: 8,743

Re: Output in Data Step

Hi:
I'd suggest you look for this documentation topic:
STATEMENTS: Output Statement which explains (in short) that the OUTPUT statement: "Writes the current observation to a SAS data set." The doc has a lengthy explanation and at least 4 examples of using the OUTPUT statement.

If the OUTPUT statement is placed inside an IF statement, then the OUTPUT statement will be executed conditionally (and, thus, write observations conditionally). Depending on how many OUTPUT statements you have inside IF statements in the whole program, you might see a different number of observations coming OUT of the DATA step program than the number of observations that are being read INTO your program.

cynthia
Occasional Contributor
Posts: 12

Re: Output in Data Step

Hi Kevin,

The If statement take the STAFFID1 variable values is blank values and in the output it will creates the two variables are CNTL and STAFF , and the values of the STAFF is Blank and CNTL variable contains the concate vaules of ENTITY and STAFFID1.Here You will get the ENTITY values only.

bye..

Thanks & Regards
RAJESH.K
Regular Contributor
Posts: 173

Re: Output in Data Step

Thank you both.

Cynthia,
Are you refering to any particular documentation on this site ?

Thank you!!
SAS Super FREQ
Posts: 8,743

Re: Output in Data Step

Hi:
Sorry, I always think that folks know that the doc is organized by topics and that they know the topics can be searched from the search box at the top of the support.sas.com page. I mean this documentation:
http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default/a000194540.htm

cynthia

( you may need a profile in order to navigate the on-line doc)

Product Documentation
--> SAS 9.2 Documentation
--> SAS(R) 9.2 Language Reference: Dictionary
--> Dictionary of Language Elements
--> Statements
--> OUTPUT Statement
Ask a Question
Discussion stats
  • 4 replies
  • 142 views
  • 0 likes
  • 3 in conversation