I have a data similar to this (This won't work because of an Array subscript out of range error):
data test;
array id {5} (1, 8, 4, 12, 23);
array a_ {5};
do i = 1 to 5;
a_[id[i]] = id[i];
end;
run;
what I want to do is, create variables begins with 'a_' and the values of array id. Meaning : a_1, a_8, a_4, a_12, a_23
This will only work if I declare array a_ with 23 members:
data test;
array id {5} (1, 8, 4, 12, 23);
array a_ {23};
do i = 1 to 5;
a_[id[i]] = id[i];
end;
run;
But then I get lots of missing variables I don't need. I only want the above 5.
How can I achieve that?