To HomePage
Getting Started with SAS
History of SAS
- SAS means Statistical Analysis System.
- SAS was created by Anthony Barr, a graduate student at the University of North Carolina, in 1966.
- By 1971, SAS was popular in the academic community and also for pharmaceutical and agricultural research.
- The syntax of SAS source code was inspired by the PLI programming language, which was popular in the 1960s and 70s.
- In 1976, SAS Institute, Inc. was incorporated by Barr, Goodnight, Sall, and Helwig. It is located in Chapel Hill, North Carolina.
- In addition to statistical analysis, SAS is used as a database management
system at many companies.
- Currently, SAS has many add-ons, including data mining tools.
Invoking SAS
- To invoke the SAS software, select Start >> All Programs >> SAS
>> SAS 9.4 (English. This will bring up the SAS Display Manager Window, which is a multiple
document interface (MDI) application that contains several important windows.
Explorer Allow the user to access various resources associated with SAS, such as the Windows file system,
SAS libraries, file shortcuts.
Editor The SAS source code editor. The last statement in your source code should be run;
To submit your SAS source code to be run, there are three options:
- Click the Submit button (icon of running person) in the tool bar,
- Select Run >> Submit in the main menu,
- press the F8 key.
A SAS program consists of data steps, that create SAS dataset for analysis, and proc steps, which analyze the SAS datasets.
Log Shows reports of which SAS data steps and procs were run, how long they took, and which errors occurred.
Output Shows the results of the SAS output in the style of The output may contain duplicate output from repeated similar
submits of source code. Use the Results window to delete duplicate items. Output in the output window is not displayed by default. It must be
turned on with Main Menu
Tools >> Options >> Preferences >> Results Tab >>
Under Listing, check the "Create listing" checkbox.
Results Viewer Window A newer-style browser window (beginning with version 9.3) that displays the results of the SAS output.
Results Window
A tree view that helps you locate items in the SAS Output Window and delete duplicate items.
Viewtable An Excel-like user interface for viewing the contents of temporary and permanent datasets.
To display the Viewtable:
Select Main Menu View >> Explorer >> Click the Work (or other) Library >> Double click the SAS workspace that you want to view.
In addition, properties of the dataset similar to those of proc contents, can be obtained by right-clicking on a dataset and
selecting Properties.
Help The Help Window is a valuable way to obtain help for writing your SAS source code.
Invoke the Help window by selecting Help >> SAS Help and Documentation in the main menu, or by pressing the F1 key.
Observations about SAS Programs
- Each line of a SAS program ends with a semicolon.
- SAS variable names
- must be not more than 32 characters long,
- start with a letter or underscore,
- consist only of of letters, digits, and underscores,
- are case insensitive.
- If the input dataset for a SAS proc is not specified, it is
assumed to be the most recently created dataset.
- Prior to SAS 9.1, the maximum number of variables was 32,767.
- Starting with SAS 9.1, the number of variables is limited only
by the amount of memory on the computer where SAS is running.
- Use the length statement to increase the length of a character variable
over its default length of 8 characters.
- Use proc contents to obtain detailed information about a SAS dataset.
- SAS uses three input styles:
- List Style. Example:
input name $ gender $ age;
- Column Style. Example:
input name $ 1-15 gender $ 16 age 17-19;
- Formatted Style. Example:
input @1 name $15. @16 gender $1. @17 age 3.;
More than one input style can be used in a given input statement.
Options Statements
Options can also be set using the SAS System Options Window, although most
of these settings are for more advanced control. To access the System Options Window:
Right-click in Output Window >> Tools >> Options... >> System...
Here is another useful options statement:
options formchar="|----|+|---+=|-/\<>*";
This option produces portable results when the output text file is moved to a different text editor or display device.