Hi All,
I have a data set with a named range that has a bunch of missing values. i want to fill in those missing values based off a condition of another variable (not in the named range). i know how to do this using array processing but was wondering if it is possible to do so in the way i've outline below.
Here is a fictitious data set to simplify my problem,
data have;
input (x1-x3) (2.) some_number;
cards;
. . . .
. . . 3
. . . 4
;
run;
data want;
set have;
if some_number > 0 then (x1-x3) = 0;
run;
data X2Zero;
if 0 then set have(keep=x:);
retain _all_ 0;
output;
stop;
run;
data have;
modify have;
if some_number gt 0 then do point=1;
set X2Zero point=point;
replace;
end;
run;
proc print data=have;
run;
No array().
data have;
infile cards truncover;
input (x1-x3) (2.) some_number;
cards;
. . . .
. . . 3
. . . 4
;
proc sql NOPRINT;
select cats('',name,'','=','0') into :lst separated by '; ' from dictionary.columns where libname='WORK' AND MEMNAME='HAVE' and name ne 'some_number'; quit;
data want;
set have;
if some_number > 0 then do;
&lst;
end;
run;
proc print;run;
Haikuo
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.