Hi, can you explain how this o/p is obtained when the following program is executed
data abc;
input a $ b;
datalines;
A 20
B 40
C 60
D 80
;
run;
data xyz;
do i = 1 to 3;
set abc;
X + 1;
output;
end;
run;
proc print data=xyz; run;
Please also throw some light at what point Set statement is read
Hi,
Execute this data step, which sheds some light of the execution:
data xyz;
do i = 1 to 3;
putlog 'BEFORE' _ALL_;
set abc;
X + 1;
output;
putlog 'AFTER ' _ALL_;
end;
run;
First the inner loop is executed 3 times, and 3 rows from abc dataset are read into the PDV, and than output. This is only the first data step cycle (_N_=1). (Remember: data step always constructs a loop if you use a set,merge,infile,update,modify statement.)
Then comes the second cycle of the data step (_N_=2).
The inner loop starts 2 times: First it is executed completely, but in the second iteration there comes the set statement. And this is the moment, when the data step finishes (exits, stops), because there are no more observations in abc dataset.
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.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.