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;
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!
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.