I am new to SAS, so I apologize if this question is too simple. I have tried extensive searching about this and it's not clear to me how to proceed.
I am trying to initialize a new SAS data set with a feature corresponding to already-existing macro variables var1,...,varN. For simplicity assume that N is already defined as a macro variable in the generating process for these variables. I want to do something along the lines of the following code, which does not work:
%let var1 = 3;
%let var2 = 2.5;
%let var3 = 1;
[...]
%let varN = 2;
Data ABC;
do i = 1 to &N;
x = var&i.;
end;
run;
I believe one of the problems is that unlike %do, the "i" is not a macro-variable. I have tried variants on cat(var,i), but it doesn't have the desired behavior since I want &var&i to resolve. Is there a way to make this work within a DATA step?