Chapter 2: Fundamental Concepts for Using Base SAS Procedures


Language Concepts

Temporary and Permanent SAS Data Sets

Naming SAS Data Sets

SAS data sets can have a one-level name or a two-level name . Typically, names of temporary SAS data sets have only one level and are stored in the WORK data library. The WORK data library is defined automatically at the beginning of the SAS session and is automatically deleted at the end of the SAS session. Procedures assume that SAS data sets that are specified with a one-level name are to be read from or written to the WORK data library, unless you specify a USER data library (see USER Data Library on page 17). For example, the following PROC PRINT steps are equivalent. The second PROC PRINT step assumes that the DEBATE data set is in the WORK data library:

 proc print data=work.debate;  run;  proc print data=debate;  run; 

The SAS system options WORK=, WORKINIT, and WORKTERM affect how you work with temporary and permanent libraries. See SAS Language Reference: Dictionary for complete documentation.

Typically, two-level names represent permanent SAS data sets. A two-level name takes the form libref.SAS-data-set . The libref is a name that is temporarily associated with a SAS data library . A SAS data library is an external storage location that stores SAS data sets in your operating environment. A LIBNAME statement associates the libref with the SAS data library. In the following PROC PRINT step, PROCLIB is the libref and EMP is the SAS data set within the library:

 libname proclib '  SAS-data-library  ';  proc print data=proclib.emp;  run; 

USER Data Library

You can use one-level names for permanent SAS data sets by specifying a USER data library. You can assign a USER data library with a LIBNAME statement or with the SAS system option USER=. After you specify a USER data library, the procedure assumes that data sets with one-level names are in the USER data library instead of the WORK data library. For example, the following PROC PRINT step assumes that DEBATE is in the USER data library:

 options user='  SAS-data-library  ';  proc print data=debate;  run; 

Note: If you have a USER data library defined, then you can still use the WORK data library by specifying WORK. SAS-data-set .

SAS System Options

Some SAS system option settings affect procedure output. The following are the SAS system options that you are most likely to use with SAS procedures:

  • BYLINENOBYLINE

  • DATENODATE

  • DETAILSNODETAILS

  • FMTERRNOFMTERR

  • FORMCHAR=

  • FORMDLIM=

  • LABELNOLABEL

  • LINESIZE=

  • NUMBERNONUMBER

  • PAGENO=

  • PAGESIZE=

  • REPLACENOREPLACE

  • SOURCENOSOURCE

For a complete description of SAS system options, see SAS Language Reference: Dictionary .

Data Set Options

Most of the procedures that read data sets or create output data sets accept data set options. SAS data set options appear in parentheses after the data set specification. Here is an example:

 proc print data=stocks(obs=25 pw=green); 

The individual procedure chapters contain reminders that you can use data set options where it is appropriate.

SAS data set options are

  • ALTER=

  • BUFNO=

  • BUFSIZE=

  • CNTLLEV=

  • COMPRESS=

  • DLDMGACTION=

  • DROP=

  • ENCODING=

  • ENCRYPT=

  • FILECLOSE=

  • FIRSTOBS=

  • GENMAX=

  • GENNUM=

  • IDXNAME=

  • IDXWHERE=

  • IN=

  • INDEX=

  • KEEP=

  • LABEL=

  • OBS=

  • OBSBUF=

  • OUTREP=

  • POINTOBS=

  • PW=

  • PWREQ=

  • READ=

  • RENAME=

  • REPEMPTY=

  • REPLACE=

  • REUSE=

  • SORTEDBY=

  • SORTSEQ=

  • SPILL=

  • TOBSNO=

  • TYPE=

  • WHERE=

  • WHEREUP=

  • WRITE=

For a complete description of SAS data set options, see SAS Language Reference: Dictionary .

Global Statements

You can use these global statements anywhere in SAS programs except after a DATALINES, CARDS, or PARMCARDS statement:

comment

ODS

DM

OPTIONS

ENDSAS

PAGE

FILENAME

RUN

FOOTNOTE

%RUN

%INCLUDE

SASFILE

LIBNAME

SKIP

%LIST

TITLE

LOCK

X

For information about all but the ODS statement, refer to SAS Language Reference: Dictionary . For information about the ODS statement, refer to Output Delivery System on page 32 and to The Complete Guide to the SAS Output Delivery System .




Base SAS 9.1.3 Procedures Guide (Vol. 1)
Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4
ISBN: 1590472047
EAN: 2147483647
Year: 2004
Pages: 260

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net