Return to Snippet

Revision: 11190
at January 27, 2009 17:05 by webonomic


Initial Code
data test1;
 input ash1 ash4 ashley;
datalines;
1 2 3
4 5 6
7 8 9
;
run;

data test2; set test1;
 array ashes ash:;
 c = ashes{1} + ashes{2};
run;

/*the result should be as follows:*/
data result;
 input ash1 ash4 ashley c;
datalines;
1 2 3 3
4 5 6 9
7 8 9 15
;
run;

Initial URL


Initial Description
Use the colon : modifier to build an array.
The colon is like a wildcard.  In this case, anything that starts with ash.
SAS Arrays hold variable names which can be used during tedious procedures such as conditional loops.

Initial Title
SAS Array Colon Modifier

Initial Tags
array

Initial Language
SAS