I am trying to use a macro to label some array variables in SAS to avoid having to type a lot of lines of code. What I'm trying to do is basically this:
%macro LABEL_ARRAY(V);
%DO I = 1 %TO 4;
%let variablename=&V(&I);
array1[&I] = "Value of &variablename"
%END
%MEND LABEL_ARRAY;
So, V is an array containing the corresponding variable names for the positions in the array array1. I'm trying to do this for more than 4 variables per array and for numerous arrays, but that's the basic idea. Basically what is happening is the array1[&I] which I would want to eventually say array1[1] for the first entry, is not using the value of I but rather just saying &I, same thing with &variablename.
Any suggestions on what might be happening? Thanks.