Basic Concepts | |
Lesson
Summary![]() ![]() |
![]() |
This page contains
|
I. Text Summary
To go to the page where a task, programming feature, or concept was presented, select a link. |
Components of SAS Programs SAS programs consist of two types of steps: DATA steps and PROC (procedure) steps. These two steps, alone or combined, form all SAS programs. A SAS program may consist of a DATA step, a PROC step, or any combination of DATA and PROC steps. DATA steps typically create or modify SAS data sets but can also be used to produce custom-designed reports. PROC steps typically analyze and process data in the form of a SAS data set but can sometimes create SAS data sets containing the results of the procedure. PROC steps control a library of prewritten routines (procedures) that perform tasks on SAS data sets, such as listing, sorting, and summarizing data. |
Characteristics of SAS Programs SAS programs are made up of SAS statements. A SAS statement usually begins with a SAS keyword and always ends with a semicolon. A DATA step begins with the keyword DATA. A PROC step begins with the keyword PROC. SAS statements are free-format, so they can begin and end anywhere on a line, one statement can continue over several lines, and several statements can be on a line. Blanks or special characters separate "words" in a SAS statement. |
Processing SAS Programs When you submit a SAS program, SAS software reads SAS statements and checks them for errors. When it encounters a DATA, PROC, or RUN statement, SAS software executes the current step in the program. |
Log Messages Each time a step is executed, SAS software generates a log of the processing activities and the results of the processing. The SAS log collects messages about the processing of SAS programs and any errors that may occur. The results of processing vary, depending on the program executed. |
Referencing SAS Files To reference a SAS file, you use a two-level name, libref.filename. In the two-level name, libref is the libref for the SAS library that contains the file, and filename is the name of the file itself. A period separates the libref and filename. If the libref is not Work, the SAS file is a permanent file. Optionally, you can use a one-level name (the filename only) to reference a file in a temporary SAS library. |
Overview of SAS Data Sets For many of the data processing tasks you perform with SAS software, you access data in the form of a SAS data set and use SAS programs to analyze, manage, or present the data. Conceptually, a SAS data set is a file consisting of two parts: a descriptor portion and a data portion. Some SAS data sets also contain an index, which enables SAS software to locate records in the data set.
Data Portion |
Descriptor Portion The descriptor portion of a SAS data set contains information about the data set, including
|
Variable Attributes Besides general information about the data set, the descriptor portion contains attribute information for each variable in the data set. The attribute information includes the variable's name, type, length, format, informat, and label. |
How SAS Files Are Stored All SAS files are stored in a SAS library, which is a collection of SAS files, such as SAS data sets and catalogs. In some operating environments, a SAS library is a physical collection of files. In others, the files are only logically related. In the Windows and UNIX environments, a SAS library is typically a group of SAS files in the same folder or directory. |
Referencing SAS Libraries To access a SAS library, you assign it a name (also known as a libref, or library reference). You can think of librefs as temporary nicknames that you use to identify SAS libraries during a SAS session. |
Types of SAS Files The individual files in a SAS library are considered members of the library. The most commonly used types of SAS files include Table, View, Catalog, and Mddb. |
Storing Files Temporarily or
Permanently Depending on the libref you use, you can store SAS files in temporary SAS libraries or in permanent SAS libraries.
|
The Sashelp and Sasuser Libraries SAS software automatically defines two permanent libraries, Sashelp and Sasuser, at the beginning of each SAS session.
|
II. Points to Remember
|
![]() ![]() ![]() ![]() ![]() |
|
![]() |
![]() |