Hi Janne,
As the variables are in sequence in dataset, beginning with opprim_lak till sluten_lak and all these variables count to 120 variables, you could try making an array of these variables(opprim_lak--z_opprim_lak) and then using a do loop take them all.
If these variables are not in sequence then what you could do is, make a macro list using proc sql (where var like '%_lak%') separated by ' ' ( let say macro variable is &dummy) and then array nums
&dummy;
If the dataset has these 120 variables as numeric data types and there is no other numeric type variables in the dataset(there can be character type vriables) then you could use array nums _numeric_;
example code:
data dx;
opprim_lak=.;
sluten_lak=.;
a_sluten_lak=.;
z_opprim_lak=.;
run;
data new;
set dx;
array nums opprim_lak--z_opprim_lak;
do i=1 to hbound(nums);
if nums=. then nums=0;
end;
drop i;
run;
proc print;run;