Академический Документы
Профессиональный Документы
Культура Документы
CREATING A DATASET:
data planman.icmr;
set sashelp.jac; ( Copies the dataset sashelp.jac into planman.icmr)
run;
If you don't specify a library name when you create a file (or if you specify the library name
Work), the file is stored in the temporary SAS data library. When you end the session, the
temporary library and all of its files are deleted.
For eg.
Data icmr;
Run;
the dataset icmr will be stored in the default library work as there is no library
created/specified for the dataset icmr.
To store files permanently in a SAS data library, you specify a library name other than the default
library name Work.
For example, by specifying the library name planman when you create a file, you specify
that the file is to be stored in a permanent SAS data library until you delete it.
1
RULES OF A SAS PROGRAM:
Two-Level Names
To reference a permanent SAS data set in your SAS programs, you use a two-level name:
libref.filename
In the two-level name, libref is the name of the SAS data library that contains the file, and
filename is the name of the file itself. A period separates the libref and filename.
For example, in our sample program, planman.icmr is the two-level name for the SAS data set
icmr, which is stored in the library named planman.
Planman.icmr
Libref.filename
Alternatively, you can use a one-level name (the filename only) to reference a file in a temporary
SAS library. When you specify a one-level name, the default libref Work is assumed. For
example, the one-level name Test also references the SAS data set named Test that is stored in
the temporary SAS library Work.
2
If the USER library is assigned, SAS uses the User library rather than the Work library
for one-level names. User is a permanent library. For more information, see the SAS
Language Reference: Concepts documentation.
To affect any single file, you can use FIRSTOBS= or OBS= as data set options instead of as
system options. You specify the data set option in parentheses immediately following the input
data set name.
3
proc print data=sasuser.heart;
run;
You can create the same output by specifying FIRSTOBS= and OBS= as data set options. The
data set options override the system options for this instance only.
options firstobs=10 obs=15;
proc print data=sasuser.heart(firstobs=4 obs=20);
run;
To specify FIRSTOBS= or OBS= for this program only, you could omit the OPTIONS statement
altogether and simply use the data set options.