|
Akshaya <akshaya.nathilvar@GMAIL.COM> wrote
>
>I have a datafile with 100 variables, lag1-lag100. I have to calculate
>a new variable and assign a value of 1, if the value of all 100
>variables is 1; else 0. Is there a simpler way, instead of using "IF
>lag1=1 and lag2=1 and lag3=1 and.... lag100=1". Thanks for any
>suggestions.
>
Untested, but how about something like
data new;
set old;
flag = 1;
array lags (100) lag1-lag100;
do i = 1 to 100;
if lags(i) ne 1 then flag = 0;
end;
run;
print data = new;
var flag;
run;
???
Peter
Peter L. Flom, PhD
Statistical Consultant
www DOT peterflom DOT com
|