Hi:
In your previous posting thread and in this posting thread several folks have posted non-macro solutions using ARRAYS. I agree with all the postings that show an ARRAY solution instead of a Macro solution. In this instance, given the data you describe and your stated purpose, using ARRAYS seems the best approach.
If you rejected those solutions because you did NOT want to to rename the variables for the ARRAY statement, as shown, then you could just list the variable names on the ARRAY statement. (although being able to list numbered variables is easier -- but the number should be at the end, unless you use the : wildcard). But anyway:
[pre]
data mydata;
input var1 var1_suffix var2 var2_suffix var3 var3_suffix var4 var4_suffix var5 var5_suffix;
datalines;
4.2 1 1.8 0 2.3 0 3.5 0 2.3 1
3 0 2.5 0 5.2 1 6.4 0 2.4 0
;
run;
data setmiss;
set mydata;
array v var1-var5;
array vs var1_suffix var2_suffix var3_suffix var4_suffix var5_suffix ;
do i = 1 to 5;
putlog 'BEFORE IF statement ' i= v(i)= vs(i)=;
if vs(i) = 1 then v(i)=.;
putlog 'AFTER IF statement ' i= v(i)= vs(i)=;
end;
run;
proc print data=setmiss;
title 'Making Change Using Arrays';
var var1 var1_suffix var2 var2_suffix var3 var3_suffix var4 var4_suffix var5 var5_suffix;
run;
[/pre]
Here's a good introduction to ARRAY processing:
http://www2.sas.com/proceedings/forum2007/273-2007.pdf
cynthia