HOME Module List Site Index About This Site glossary" Resources Innovative Technology Center UT Statistics Courses
Using SAS Choose Design ANOVA Compare Means Regression Examples
Using SAS Using SAS: Table of Contents

Working with SAS
Running, printing and saving

Running a SAS program

With the Editor Window active (click on it), click the running man icon to submit the program. The instructions in the program are then carried out by the SAS System.

Statements and any notes, warnings, or errors generated by the statements are written to the Log Window. This example shows typical problems:

Illegal syntax is underlined and given error numbers. Here nothing should follow the DATALINES statement.

Later errors about X and Y variables not found could be due to the syntax problem, as that would prevent the dataset from being created.

But notice there is no semicolon following DATA one. This means there is no INPUT statement, as it is combined with DATA. No illegal syntax is created by this, so there are no errors, but this mistake will also cause the X and Y variables to not be found.

16   DATA one
17        INPUT x y;

ERROR 22-322: Syntax error, expecting one of the following: ;, CANCEL, PGM.

ERROR 200-322: The symbol is not recognized and will be ignored.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.ONE may be incomplete.  When this step was stopped there 
   were 0 observations and 0 variables. NOTE: DATA statement used (Total process time): real time 0.07 seconds cpu time 0.01 seconds 23 ; 24 PROC REG; 25 MODEL y=x; ERROR: Variable Y not found. ERROR: Variable X not found. NOTE: The previous statement has been deleted. 26 RUN; WARNING: No variables specified for an SSCP matrix. Execution terminating. NOTE: PROCEDURE REG used (Total process time): real time 0.04 seconds cpu time 0.01 seconds

In general, when fixing errors, go to the top of the log, and correct the first errors you see. Subsequent errors may be a result of the first errors. Interpreting Log Window messages so you can identify the error takes practice

After fixing any problems you find, clear the Log and Results Viewer Windows (new page icon or Edit-Clear All), and run the program again. If you do not clear windows, text accumulates and it will be confusing to separate old errors and output from new.

Saving your work

Any window in SAS can be saved. Make the window active (click on it), and use the menu File-Save As. Typically only the Editor Window is saved, as other output can be recreated by rerunning the program.

Instead of saving your output, you might wish to copy it into a word processor, to reformat as desired. This is easily done by highlighting (easiest to use Edit-Select All), then copy and paste.

Graphs can be saved to a file by File-Export as Image, or again, copied and pasted into word processors.

SAVE YOUR PROGRAM occasionally (Ctrl-S) as you work. It is not enjoyable to lose work due to computer or power failure.

Of course all windows can also be printed, using File-Print. If you just installed SAS, you may have to configure SAS for your printer, File-Print Setup. Here you can define page sizes, and set the default SAS font to fit the page.

Also, if you will be printing, become familiar with the OPTIONS statement, such as


which defines a page to be 75 characters wide (SAS expects a monospace font), and 53 lines. Adjust this to make SAS output fit onto the printed page.

Related Topics:                                                                                                     Using SAS: Table of Contents
SAS windows
Menus and icons
SAS programs


Home | Contact us | Module list & summary | Glossary/Terms | About this site | Stats courses | Links | Index