BookmarkSubscribeRSS Feed
KevinC_
Fluorite | Level 6
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!
4 REPLIES 4
Cynthia_sas
Diamond | Level 26
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
K_rn_tiR_jesh
Calcite | Level 5
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
KevinC_
Fluorite | Level 6
Thank you both.

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

Thank you!!
Cynthia_sas
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1732 views
  • 0 likes
  • 3 in conversation