Overview of SAS® programs


Why use SAS programs vs. SAS Insight or SAS Analyst?

  1. More flexible
  2. More powerful
  3. More dynamic
  4. Faster for programs used repeatedly

SAS Programs: Data steps and Proc steps (Section 1.3)

SAS programs are made up of a collection of data steps, proc steps and "open code." Open code is simply special code that does not require being in data or proc step. Examples include the run, quit and options statements and some macro statements.


Programming statements (Basic rules) (Section 1.1)

  1. Every statement ends with a semicolon!!
  2. SAS is case insensitive.
  3. Statements can continue over more than one line.
  4. More than one statement can be on a single line (separated by a semicolon).
  5. Statements can start in any column (with a few exceptions).
  6. A statement beginning with an asterisk is a comment.
  7. SAS ignores extra spaces. (So use spaces and comments to make programs more readable.)


Executing a SAS program (Section 1.5)


SAS Windows (interactive SAS) (Section 1.6)

There are 4 main windows in SAS: Program editor, log, output and graphics windows. In addition, vsn. 7+ has a results and an explorer window and vsn. 8+ has an enhanced editor window.


Submitting a program (interactive mode): (Section 1.7)

  1. Input program into the program editor (type, open a text file).
  2. Edit code (if necessary).
  3. Submit the code (icon, menu, F3).
  4. Mark selected code and submit—this submits only the marked portion.
  5. Check the log and output windows to see if there are any errors, etc.
  6. Recall the text (icon, menu, F4)
  7. Return to step 2.

Also see The Little SAS® Book sections 1.8 (Reading the SAS log), 1.9 (Reading SAS output) and 1.10 (SAS options).