Reputation: 95
Beginner question: I am trying to use SAS macro arrays as explained in this article: http://www2.sas.com/proceedings/sugi31/040-31.pdf, specifically in the section %ARRAY WITH DATA= AND VAR=
. Unfortunately there are no examples of a full program using this, and I can't find any simple examples online. I tried to create a simple example, guessing at some things, but it didn't work. (I got two errors for each macro: "Apparent invocation of macro ARRAY not resolved." and "Statement is not valid or it is used out of proper order.") What am I doing wrong?
Here is the code:
data data1;
input variable1;
datalines;
1
2
3
4
run;
%array(array1, data=data1, var=variable1);
%do_over(array1, phrase=PROC PRINT DATA=data1(obs=?));
run;
(Also, does anyone know the name of the SAS website which is sort of like this one? I remember seeing it but I can't find it again.)
Thanks!
Upvotes: 2
Views: 9506
Reputation: 2174
You can download a zip file with the macros at the SAS Community website: http://www.sascommunity.org/wiki/Tight_Looping_with_Macro_Arrays
Include them in your SAS program and it should work.
Upvotes: 3