Hi all,
I have to check character values across 50 variables.I am using datastep where i am outp only those records who have the values. but getting error.
The program i am trying is somewht like this:
data test1;
set test;
do i=1 to 50 by 1;
if diagnosis_code&i like 'E10%' then output;
end;
run;
The dataset is huge like 19+ million records.(Can't think of transpose)
Thanks a lot in advance!
You need to define an array over your variables, and loop through that.
You want the observations having the diagnosis-code only once even if diagnosis_code1 and diagnosis_code4, for example, have "E10%"?
untested:
data want;
set test;
array codes[50] diagnosis_code1-diagnosis_code50;
do i = 1 to dim(codes);
if codes[i] like 'E10%' then do;
output;
leave;
end;
end;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.