Arrays
Arrays are simply lists of variables. SAS appends a number, 1-n,
to the array name, to create the variables within the array. Arrays
can be Character or Numeric, but not mixed. Here are a few examples:
Data work.A;
* A numeric array of 10 items;
Array exampleA{10};
* An array of existing variables in the dataset;
* All items in the array must be of the same
type;
Array exampleB variable1 variable2 var3-var9;
* A numeric array initialized to a list of
values;
Array exampleC{12} (31 28 31 30 31 30 31 31
30 31 30 31);
* A character array initialized to a list
of values;
Array exampleD{12} $3 ('Jan' 'Feb' 'Mar' 'Apr'
'May' 'Jun'
'Jul'
'Aug' 'Sep' 'Oct' 'Nov' 'Dec');
Do i=1 To Dim(exampleC);
last_day=exampleC{i};
month=exampleD{i};
Output;
End;
Run;
|