Chapter Contents

Previous

Next
SAS Component Language: Reference

Using Temporary Arrays to Conserve Memory

If you want to use an array in an SCL program but do not need to refer to array elements by name, then you can add the _TEMPORARY_ argument to your ARRAY statement:

array total[4] _temporary_;

When you use the _TEMPORARY_ argument, you must use subscripting to refer to the array elements. For example, you must use TOTAL[2] to refer to the second element in the array TOTAL, defined above. You cannot use the variable name TOTAL2 as an alternative reference for the array element TOTAL[2]. Using the _TEMPORARY_ argument conserves memory. By default, SCL allocates memory for both the name of the array and the names of the individual array elements. However, when you use the _TEMPORARY_ argument, SCL allocates memory only for the array name. For large arrays, this can result in significant memory savings.

Note:   Do not use the _TEMPORARY_ option if you plan to use the SET routine to read values from a SAS table directly into array elements. You must use the GETVARN or GETVARC function to read values from a SAS table into the elements of a temporary array.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.