In my data I define an array as all the variables starting with rev_:
data df;
set def;
array vnames rev:;
run;
And now I want to repeat the means function over this array. For example, let's say each element in vnames is a different class variable i'd like part of my command.
Let's say rev: actually expands to rev1 rev2 rev3 revolution
So I want sas to do this:
proc means data=df;
var rev1;
run;
proc means data=df;
var rev2;
run;
proc means data=df;
var rev3;
run;
proc means data=df;
var revolution;
run;
Now the function I end up calling might be more complex. I thought I should set up a macro and then run the array and macro together, but I have no idea how to do this.
I don't really have any sample data, but the idea is to run the same command (or series of commands, ie a macro) over a named array.
proc means data=def ; var rev: ; run;