SAS Do loop over Set statement -


i have dataset named test, 1 numeric variable named 'id' having 3 observations as:

1 2 3 

i creating 1 using loop below:

data abc;  = 1 3;    set test;     m+1;     output;  end; run; 

this returns 3 observations.

if change loop 1 4 , remove output statement, empty dataset. unable head around this. can please explain this?

most sas data steps end when step executes set or input statement , finds there no more input available. happening.

sas writes observations @ end of data step iteration. exception when have explicit output statement coded. without output step sas write out observation when gets end of data step. when rmeoved output made step same as:

data abc;  = 1 3;    set test;     m+1;  end;  output; run; 

but if loop iterates more times there observations set statement read never end write output since read past end of input dataset , stop.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -