My code is returning an error an am not sure why
Original code
DATA scoredata1;set scoredata0;Array sc(3) score1 score2 score3;Array new (3) ns1 ns2 ns3;DO i=1 TO 3;IF sc(i)=777 then new(i)= .;else if sc NE 777 then new(i) = sc(i) ; end;run;
else new(i) = sc(i) ;
is all you need i think
The error is you are mising the array index while referencing in your
else if sc NE 777 then new(i) = sc(i) ;
which should have been
else if sc(i) NE 777 then new(i) = sc(i) ;
View solution in original post
Thanks!
Or even terse would be just one statement and that is
if sc(i) NE 777 then new(i) = sc(i) ;
Coz new(i) is anyway initialised with .
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Submit your idea!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.