BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
shengnian
Fluorite | Level 6

 

I am learning SAS data setp flow recently, and I found a interesting question. Please see the following programs. The only difference between data bb and data cc is that " put _all_" was a comment statement in data bb, which  was not in data cc.

 

However, it made a big difference to the result. I could underatand the number of dataset bb is zero, but I wonder what happened to dataset cc.  Can someone explain it?  Thanks!

 

data aa;
do A = 1 to 20;
output;
B = A;
end;
run;

 

data bb;
do until (i >= 5);
set aa;
/* put _all_*/
i = _N_;
i + 1;
end;
run;

 

data cc;
do until (i >= 5);
set aa;
put _all_
i = _N_;
i + 1;
end;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If the code you ran is exactly as posted you get a difference because the Put _all_ does not have a ; at the end and the next line i=_n_ is considered part of the PUT instruction.

View solution in original post

4 REPLIES 4
ballardw
Super User

If the code you ran is exactly as posted you get a difference because the Put _all_ does not have a ; at the end and the next line i=_n_ is considered part of the PUT instruction.

shengnian
Fluorite | Level 6

You are right, I have noticed it yet. Thanks very much! Smiley LOL

PGStats
Opal | Level 21

@shengnian, please mark @ballardw's answer as Accepted.

PG
shengnian
Fluorite | Level 6

Thanks for your remainding!Smiley Happy

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
  • 991 views
  • 2 likes
  • 3 in conversation