How do I write a SAS program?
SAS programs are made up of SAS statements. A SAS statement has two important characteristics:
- It usually begins with a SAS keyword.
- It always ends with a semicolon.
Remember that SAS programs include two types of steps: DATA steps and PROC steps. DATA steps begin with the keyword DATA, and PROC steps begin with the keyword PROC. Generally, a step ends with a RUN statement or when a new DATA or PROC step begins. A RUN statement tells SAS to process all of the preceding lines of the step.
Each step in a SAS program is made up of a sequence of statements. SAS statements usually begin with an identifying keyword, and they always end with a semicolon.
SAS statements are free-format. This means that
- they can begin and end anywhere on a line.
- one statement can continue over several lines.
- several statements can be on one line.
To create a new program in SAS Studio, click Folders in the navigation pane. Then click and select SAS Program.