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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 790 views
  • 0 likes
  • 3 in conversation