Write a Program

It is easier than ever to program in SAS. All you need to do is open your browser, start SAS Studio, open a new program tab, and start writing your program. As you enter your code, you’ll notice that SAS Studio has several features to help you reduce your programming time, including autocompletion for hundreds of SAS statements and procedures as well as built-in syntax help that includes links to the more extensive SAS Product Documentation.

Code Example That Shows Autocomplete and Syntax Help

To get started, let’s write a very simple program that uses a sample SAS table from the Sashelp library. The program displays the contents of the Sashelp.Class table as a report.

Open SAS Studio and click Program in SAS on the Start Page tab. Enter the following code in the Program.sas tab that is created for you.

Note: By default, SAS Studio opens with the Start Page tab. If you have already been experimenting with SAS Studio and the Start Page tab is no longer open, you can create a new program by selecting New > SAS Program from the toolbar.
proc print data=sashelp.class;
run;

Notice that each SAS statement must end with a semicolon.

To run the code, click Run on the toolbar. The results open automatically with a listing of the data in the Sashelp.Class table.

Results from PROC PRINT Statement
Last updated: September 14, 2022