SAS OnlineTutor®: Basic and Intermediate SAS®的learning path见《SAS学习笔记：开篇》
General form, basic LIBNAME statement: LIBNAME libref ‘SAS-data-library‘;
The LIBNAME statement is global, which means that the librefs remain in effect until you modify them, cancel them, or end your SAS session.Therefore, the LIBNAME statement assigns the libref for the current SAS session only. Each time you begin a SAS session, you must assign a libref to each permanent SAS data library that contains files that you want to access in that session. (Remember that Work is the default libref for a temporary SAS data library.)When you end your SAS session or delete a libref, SAS no longer has access to the files in the library. However, the contents of the library still exist on your operating system.
Remember that you can also assign a library from the SAS Explorer using the New Library window (as you did if you completed the lesson Basic Concepts ). Libraries that are created with the New Library window can be automatically assigned at startup by selecting Enable at Startup.
General form, basic PROC CONTENTS step: PROC CONTENTS DATA=SAS-file-specification NODS;RUN;
PROC CONTENTS and PROC DATASETS overlap in terms of functionality. Generally, these two function the same:
- the CONTENTS procedure
- the CONTENTS statement in the DATASETS procedure.
PROC CONTENTS <options>;RUN;
PROC DATASETS <options>;CONTENTS <options>;QUIT;
The major difference between the CONTENTS procedure and the CONTENTS statement in PROC DATASETS is the default for libref in the DATA= option. For PROC CONTENTS, the default is either Work or User. For the CONTENTS statement, the default is the libref of the procedure input library. Notice also that PROC DATASETS is an interactive procedure that requires a QUIT statement rather than a RUN statement.
y default, PROC CONTENTS and PROC DATASETS list variables alphabetically. To list variable names in the order of their logical position (or creation order) in the data set, you can specify the VARNUM option in PROC CONTENTS or in the CONTENTS statement in PROC DATASETS.
If you use two-digit year values in your data lines, external files, or programming statements, you should consider another important system option, the YEARCUTOFF= option. This option specifies which 100-year span is used to interpret two-digit year values.
All versions of SAS represent dates correctly from 1582 A.D. to 20,000 A.D. (Leap years, century, and fourth-century adjustments are made automatically. Leap seconds are ignored, and SAS does not adjust for Daylight Savings Time.) However, you should be aware of the YEARCUTOFF= value to ensure that you are properly interpreting two-digit years in data lines.
As with other system options, you specify the YEARCUTOFF= option in the OPTIONS statement:
When a two-digit year value is read, SAS interprets it based on a 100-year span which starts with the YEARCUTOFF= value. The default value of YEARCUTOFF= is 1920.
However, you can override the default and change the value of YEARCUTOFF= to the first year of another 100-year span. For example, if you specify YEARCUTOFF=1950, then the 100-year span will be from 1950 to 2049.
Using YEARCUTOFF=1950, dates are interpreted as shown below:
Remember, the value of the YEARCUTOFF= system option affects only two-digit year values. A date value that contains a four-digit year value will be interpreted correctly even if it does not fall within the 100-year span set by the YEARCUTOFF= system option.
General form, FIRSTOBS= and OBS= options in an OPTIONS statement:
where n is a positive integer. For FIRSTOBS=, n specifies the number of the first observation to process. For OBS=, n specifies the number of the last observation to process. By default, FIRSTOBS=1. The default value for OBS= is MAX, which is the largest signed, four-byte integer that is representable in your operating environment.