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
SAS Super FREQ
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
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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