SAS is a statistical software that is used for estimating econometrics models and it is made up of a number of modules with specialized procedures for analysis relating to various disciplines. It enables you to perform the following tasks:
- data entry, retrieval, and management
- report writing and graphics design
- statistical and mathematical analysis
- business forecasting and decision support
- operations research and project management
- applications development
Overview of SAS Products
- Base SAS – Data Management and basic procedures
- SAS/STAT – Statistical Analysis
- SAS/Graph – Presentation quality graphics
- SAS/ OR – Operations Research
- SAS/ETS – Econometrics and Time Series Analysis
- SAS/IML – interactive matrix language
- SAS/AF – Application facility
- SAS/QC – Quality Control
There are other specialized products for spreadsheets, access to database, connectivity between machines running SAS, etc…
Basic Structure of SAS Programming
Every SAS program consists of two essential components:
The Data Step: The data step is the part of the SAS program that reads in and manipulates the data to prepare it for statistical analysis.
The procedure step: The procedure step consists of the separate statistical tests that you wish to run, including averages, frequency tables and regressions.
Running a SAS program
There are two ways to run a SAS program:
From the SAS editor – you can create and edit your SAS program in the editor provided by the SAS system (to run this, go to Start Menu > Programs > The SAS System > SAS). When you want to run your program, click on the Run icon, which looks like a little guy running. Your results will display in the output window and a log, including any errors that might have been generated (helpful when debugging your program) will appear in the log window.
In batch mode – alternatively, you can create your program in any text editor (including the SAS systems editor) and run the program by right clicking the icon and selecting Batch SAS. This will generate, in addition to your .sas file, a .log file and a .lst file. The log file contains a log of your job, including the errors. The listing file contains the output from your procedures.
There are other ways to edit and execute SAS programs, but these are the most common ways to execute SAS Programming.
Once the data have been imported and properly formatted, it’s time to get to work performing actual numerical analysis. The SAS base package contains many procedures for analysis and statistical testing, and volumes have been written about how to use these procedures.
The general rules for SAS procedures are:
- Every SAS procedure must specify which dataset the procedure will work with
- Every SAS procedure must end with run;
- (In general) Every SAS procedure must specify which variables will be analyzed
- (In general) The syntax for a SAS procedure follows the format
proc procedure_name data=dataset_name;
var variable1 variable2 variable3;
Some Preliminary Concepts and Rules of SAS Programming
- SAS variable names must be 32 characters or less, constructed of letters, digits and the underscore character. (Before version 7, the limit was 8.)
- It’s a good idea not to start variable names with an underscore, because special system variables are named that way
- Data set names follow similar rules as variables, but they have a different name space
- There are virtually no reserved keywords in SAS; it’s very good at figuring things out by context
- SAS is not case sensitive, except inside of quoted strings. Starting in Version 7, SAS will remember the case of variable names when it displays them
- Missing values are handled consistently in SAS, and are represented by a period (.)
- Each statement in SAS must end in a semicolon (;)