SAS Component Language Dictionary |
Category: | List |
Syntax | |
Details | |
The Local Environment List | |
The Global Environment List | |
Recommendations for Modifying Environment Lists | |
See Also |
Syntax |
list-id=ENVLIST(<envlist-type>); |
specifies which environment list to return:
'G' | |
'L' |
returns the identifier for the local environment list. (This is the default.) |
Details |
When the SAS session starts, a global environment list that persists for the entire session is created. When a SAS/AF or FSEDIT application starts executing, a local environment list is created for that application. This local environment list persists for the duration of that application and is available to each program that runs in that application (for example, a program that is invoked by the DISPLAY routine).
Environment lists are special lists that can contain numeric items, character items, and sublist items. You use the item names to fetch the items. You can use the item names to fetch the items. Environment lists provide a means of creating global variables that can be shared among different SCL programs, much like macro variables. However, unlike macro variables, the names in an environment list do not have to be valid SAS names, and the values in an environment list can be other lists, if you want to associate a lot of data with a single name. For example, you can read the contents of a small SAS table into a list and place the contents in the global environment list so that other SCL programs do not have to read the table to fetch data.
You can also insert items that do not have names.
The local environment list, which is returned by ENVLIST('L'), contains data that is available only to the current application. Each executing application has its own unique local environment list. Both the contents of an application's environment list and the list itself are deleted when the application ends.
The global environment list, which is returned by ENVLIST('G'), contains data that all SAS applications can share during the same SAS session. The data remains in the global environment list until an SCL program explicitly removes it. Thus, after one application puts data into the global environment list, the application can exit, and another application can fetch the data.
You can insert only global lists into the global environment list. Global lists are created with MAKELIST or MAKENLIST (using the 'G' visibility value), or they can be new lists that have been copied from other global lists. A fatal error results if you try to insert a local list into the global list.
It is strongly recommended that you insert only named items into environment lists and that you choose names that are unambiguous. If you add items that have simple names, other applications are more likely to unknowingly use the same name and to accidentally overwrite your data.
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.