Processing Variables with Arrays |
Expanding Your Use of
Arrays |
Creating Temporary Array Elements
You can create temporary array elements for DATA step processing without creating new variables by specifying _TEMPORARY_ after the array name and dimension. data finance.report; set finance.qsales; array sale{4} sales1-sales4; array Goal{4} _temporary_ (9000 9300 9600 9900); array Achieved{4}; do i=1 to 4; achieved(i)=100*sale(i)/goal(i); end; run; Temporary array elements do not appear in the resulting data set. |
SAS Data Set Finance.Report
SalesRep
Sales1
Sales2
Sales3
Sales4
Britt
8400
8800
9300
9800
Fruchten
9500
9300
9800
8900
Goodyear
9150
9200
9650
11000
Achieved1
Achieved2
Achieved3
Achieved4
93.333
94.624
96.875
98.990
105.556
100.000
102.083
89.899
101.667
98.925
100.521
111.111
Temporary array elements are useful when the array is only needed to perform a calculation. You can improve performance time by using temporary array elements. |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.