SAS/Programming

SAS Programming Modes
SAS uses a variety of programming modes to manipulate data. Among them are :
 * Global statements, which define or alter the program environment
 * SAS data steps, which use the data step language to create, input, modify, and output data in rectangular database tables (datasets).
 * A SAS datastep commences with the DATA keyword, and is generally terminated with a RUN statement.
 * Procedures, which are pre compiled structures designed to produce defined outcomes given (usually) the input of SAS datasets and one or more control parameters
 * A SAS procedure commences with the PROC keyword followed by the procedure name, and is generally terminated with a RUN or QUIT statement.
 * SQL statements, issued within PROC SQL, that provide an alternative (and more standard) method of creating and modifying database tables
 * IML (Interactive Matrix Language) statements, issued within PROC IML, that provide a method of manipulating matrix data.
 * SAS Graph statements, which use a special vocabulary of statements to control graphical output.
 * ODS statements, which use another special vocabulary of statements to control output to external media
 * The SAS Macro Language, which modifies program statements prior to execution, and allows generic code to be adapted for use each time it is run, by substitution of control parameters.
 * Macro code is generally identified by statements which contain keywords prefaced by % or &.

A simple example
The following macro computes frequencies, plots them and store the graph in a file. Instead of repeating all those steps each time, you just need one line to perform all these tasks together.


 * The declaration of a macro begins with %macro and ends with %mend.
 * Arguments in the macro are preceded by the & symbol.