riskassure
Programmer
I came across a program at work that I could not decipher. I googled around and could not find any answers. Can anyone interpret the following code for me (code modified for presentation purposes):
data abc;
_n_ ++_n_ < n;
set xyz point=_n_ ;
workstn2 = workstn;
set xyz nobs=n end=end;
if workstn ¬= workstn2 and 20 <= a < 30 then a = a*0.5 ;
if workstn ¬= workstn2 and 10 <= a < 20 then a = a*0.6 ;
if workstn ¬= workstn2 and a < 10 then a = a*0.7 ;
run;
Specifically, what does the line
_n_ ++ _n_ < n;
mean? And why are there two set statements in the data step? I have a feeling that it is somehow taking two copies of the table xyz, shifting one table from the other, and comparing the variable workstn... but I am not certain, since I have never seen this before...
Thanks in advance!!
~~CW~~
data abc;
_n_ ++_n_ < n;
set xyz point=_n_ ;
workstn2 = workstn;
set xyz nobs=n end=end;
if workstn ¬= workstn2 and 20 <= a < 30 then a = a*0.5 ;
if workstn ¬= workstn2 and 10 <= a < 20 then a = a*0.6 ;
if workstn ¬= workstn2 and a < 10 then a = a*0.7 ;
run;
Specifically, what does the line
_n_ ++ _n_ < n;
mean? And why are there two set statements in the data step? I have a feeling that it is somehow taking two copies of the table xyz, shifting one table from the other, and comparing the variable workstn... but I am not certain, since I have never seen this before...
Thanks in advance!!
~~CW~~