How do I run a SAS program?
Let's run a sample SAS program and view the results. This program creates a new SAS table from an existing SAS table. The new table includes only a subset of rows from the existing table.
The Sashelp library contains sample SAS tables that you can use as you learn about SAS. You can learn more about SAS libraries and accessing data.
- Copy and paste or type the following code into the program editor in SAS Studio. If you need to create a new program window, open the Server Files and Folders section of the navigation pane. Then click and select SAS Program.
where age > 12;
proc print data=work.teenstudents;
- Notice that when you paste this text into the program editor, SAS keywords are color-coded. You can right-click a keyword to view detailed syntax help.
The DATA step creates a new SAS table named Teenstudents in the temporary Work library. The Teenstudents table is created from rows in the Class table in which the value of Age is greater than 12.
The PROC PRINT step lists all of the data in the Teenstudents table.
- Click to run the program. The Results tab opens automatically.
The results in SAS Studio are easy to use, but what if you need them in a different format so that you can share them with someone else? By clicking the appropriate button on the Results toolbar, you can download your results as an HTML, PDF, or RTF file, and save them or open them in the default application for that format.