Loading in 2 Seconds...
Loading in 2 Seconds...
Chapter 1: Overview of SAS System Basic Concepts of SAS System. The SAS Programming Process. Define the Business Need. Create a SAS Program. Enter the SAS Program Code. Debug or Modify. Process the SAS Program Code. Review the Results. Reporting and Graphics. Data Access and
Define the Business Need
Create a SAS Program
Enter the SAS Program Code
Debug or Modify
Process the SAS Program Code
Review the Results
SAS program. It is created by users for solving problems. It can be created by the SAS Program Editor, or by any text editing software, then, copy and paste into SAS Program Editor, in order to be executed.
A raw data set in .dat format. In order to have a SAS program to read the text file, a statement linking the physical path storing the data in the SAS program is required. This is accomplished by ‘Infile’ statement in a SAS program.
SAS Program Files
A SAS program is a sequence of steps that the user submits for execution.
DATA steps are typically used to create SAS data sets.
PROC steps are typically used to process SAS data sets (that is, generate reports and graphs, edit data, and sort data).
There are many different types of PROC steps.
. . .
A SAS program is a sequence of steps:
A step is a sequence of one or more statements.
A statement usually starts with a keyword and always ends in a semicolon (;).
KEYWORD . . . ;
input name $ 1-8 age 11-12;
This INPUT statement can read the following data records:
Because NAME is a character variable, a $ appears between the variable name and column numbers.
SAS data set name, Date/time created, # of variables, # of observations.
For each variable: Name, Type, Length, Position, Label.
Policy, pOLIcY , total_bud2010_ , _N_ are valid
Total-budget , 2010_budget , #num_stud are NOT valid
Variable format is the format of outputting the variable in the SAS data set.
A Library Name
Path to the physical HD location
Every SAS file is stored in a SAS library.
SAS data set is one type of SAS file.
In some operating environment, a library is a physical collection of files.
In others, such as Windows and Unix environments, a library is a logical name consisting of a group of files that are stored in a physical location in a storage space.
Library can be Temporary or Permanent.
A SAS library must be prepared in order for a SAS program to reach the directory to either read or output a SAS data set.
SAS program only need to recognize the Library reference name.
A SAS library name has two-levels:
Libref is the the SAS Library name that is connected to a physical directory in a storage location in your computer.
fielname is a file stored in the directory referred to the Libref.
Temporary SAS data set:
The LIBREF is always WORK, which is already available in the Libraries folder in Explore Panel of the SAS working environment.
Example: WORK.admit is a temporary SAS data set.
NOTE: one can ignor ‘WORK’ and specify the data set as admit, if it is stored in the WORK library as temporary library.
Permanent SAS data set:
The Libref is defined by the user.
For example: Mylib.admit refers to a SAS data set admit which is stored in the library named Mylib.
s575, _s575 , s575_ _s575_ are valid LIBREF
S-575 , sta575_online are not valid
The Admit data set contains admission information for patients in a wellness clinic.
A SAS program does the following tasks:create a SAS library: Mylib,reads SAS data set Admit from the library clinic, select the patients with HIGH activity level, store the selected patients in the Mylib library with the SAS data set name: Admit_high,print the observations in the new data set
PROC print data=Mylib.admit_high;