So here's my method of making an Array Macro Variable (nothing native to the best of my knowledge) on which I will then use numbered indexes to massage the table later:
data _null_;
i = 1;
DO name = "bear","pig","velociraptor";
ii = left(put(i,2.));
call symput('variable_name'||ii,name);
i+1;
put name;
END;
The output of that is the following
bear
pic
velo
Oh yeah, that happened. SAS guessed the length of name for the loop at 4 characters, then truncated velociraptor.
The solution was to use the length name $12:
data _null_;
i = 1;
length name $12;
DO name = "bear","pig","velociraptor";
ii = left(put(i,2.));
call symput('variable_name'||ii,name);
i+1;
put name;
END;
No comments:
Post a Comment