SAS/Basics

Why use SAS ?

 * SAS works directly on the data sets without loading them into memory. This allows you to manipulate large database such as census data sets.

Why not use SAS ?

 * SAS is not available for mac users
 * SAS is proprietary and expensive. You may prefer R which is open-source and cross-platforms.
 * There is no systematic syntax. The syntax is specific to each PROC.

Alternative to SAS

 * R : an open source statistical package
 * Stata : includes the very latest econometric methods
 * SPSS : an easy to use statistical software

SAS Environment

 * EDITOR (F5) : This is a text editor with syntax highlighting where you write your program. You can save your program with the .sas extension.
 * LOG (F6) : includes all information about the computing process such as errors, warnings, computing time (cpu). You can save it with the .log extension.
 * OUTPUT (F7) : This includes all the results. You can save it with the .lst extension.
 * EXPLORER (CTRL +D) : browse all your SAS libraries and open datasets in the SAS data editor.
 * HELP (F1) : Help system.

SAS Programming Style

 * SAS includes procedures and data step. data steps generally create a new dataset and procedure step compute some quantity of interest using existing data.
 * Each step is ended with the run ; statement.
 * Semicolons ; are end of statement delimiter.
 * SAS works directly on a database without loading it into memory. This facilitates manipulation of large databases.
 * F3 executes the current program or the selected lines of the program.
 * After executing a program, you first look at your log and then you can have a look at your results.
 * Comments begin with a star and terminated by a semicolon or are contained within a slash-star and a star-slash c-style block comment:
 * SAS is not case sensitive ("a" and "A" are similar to SAS)

Preamble
The following lines are often useful at the beginning of a SAS program :

dm stands for "Display Manager"
 * Libname : It is often useful to defines libname. A libname is nothing more than an alias for a directory.
 * Options : the following line in head of a program makes it easier to read the log.
 * Clean log and output windows : At the beginning of a program it is often convenient to clean the log and the output: