Chapter Contents |
Previous |
Next |
Where to Use |
You can use SAS data sets as input for DATA or PROC steps by specifying the name of the data set in
How and When Names Are Assigned |
If you are creating SAS data views, you assign the data set name using one of the following:
Note: Because you can specify them both as data sets in the same program statements
but cannot specify the member type, SAS cannot determine from the program
statement which one you want to process. This is why SAS prevents you from
giving the same name to SAS data views and SAS data sets in the same library
Parts of a Data Set Name |
libref.member-name.membertype
The elements of a SAS data set name include the following:
When you refer to SAS data sets in your program statements, use a one-level or two-level name. Use a one-level name when the data set is in a temporary library, such as USER or WORK. Use a two-level name when the data set is in some other permanent library you have established. A two-level name consists of both the libref and the data set name. A one-level name consists of just the data set name.
Two-level Names |
libref.data-set-name
When you create a new SAS data set, the libref indicates where it is to be stored. When you reference an existing data set, the libref tells SAS where to find it. The following examples show the use of two-level names in SAS program statements:
data revenue.sales; proc sort data=revenue.sales;
One-level Names |
You can omit the libref, and refer to data sets with a one-level name in the following form:
data set-name
Data sets with one-level names are automatically assigned to one of two special SAS libraries: WORK or USER. Most commonly, they are assigned to the temporary library WORK and they are deleted at the end of a SAS job or session. If you have associated the libref USER with a SAS data library or used the USER= system option to set the USER library, data sets with one-level names are stored in that library. See SAS Data Libraries for more information on using the USER and WORK libraries. The following examples show how one-level names are used in SAS program statements:
data 'test3'; set 'stratifiedsample1';
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.