DATA Step, Macro, Functions and more

question

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 100
Accepted Solution

question

Hi all:

     I am basic level programmer. Just have a quick question. what does output do in this situation? 

data lb;

  set rawdata.lab;

if A eq 1 or 2 or 3 then B= "DOSE ADMINISTRATION";
else " ";
output;

run;

 

 

 


Accepted Solutions
Solution
‎04-20-2017 04:14 PM
Super User
Posts: 19,770

Re: question

@buddha_d Please mark the question as solved, not this post, but the one that answered your question.

View solution in original post


All Replies
Respected Advisor
Posts: 4,919

Re: question

Get the syntax right with:

 

data lb;
set rawdata.lab;
if A in (1, 2, 3) then B= "DOSE ADMINISTRATION";
run;
PG
Super User
Posts: 11,343

Re: question

For all intents in purposes in your example it does nothing. If there is no output statement in a data step one is assumed at the bottom of the code.

You could test this by creating a small example input data set and running the code both with and without the output.

 

Output is executeable. It will write the current state of the data vector to an output data set. So if you have multiple output statements you may generate multiple records from a single input record.

Also you may specify the name of a data set that appears on the DATA statement (data setone settwo; specifies two data sets for example) to indicate which data set(s) get the data.

 

 

Frequent Contributor
Posts: 100

Re: question

Thanks 

Solution
‎04-20-2017 04:14 PM
Super User
Posts: 19,770

Re: question

@buddha_d Please mark the question as solved, not this post, but the one that answered your question.

Super User
Posts: 19,770

Re: question

I said not this post..... Smiley Sad

Frequent Contributor
Posts: 100

Re: question

sorry I am not so got confused.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 185 views
  • 0 likes
  • 4 in conversation