Dr. Alex Dong's Blog

SAS Series 5: Create and run SAS programs Cont.

Use the Results window

Once you have created output, the Results window opens.

On Windows, the Results window covers the Explorer window. You can switch between the two windows using the tabs at the bottom of the window.


  1. Look at the Results window. The Results node at the top of the window contains a folder for the output of the PROC PRINT procedure. The folder is labeled with the procedure name and the title of the report.
  2. Click the expansion icon next to the the folder.10
  3. Double-click Data Set WORK.TEST. The Output window scrolls to the top of the output.
    Each time you run a program that creates output, the new output is appended to the last output in the Output window. You can double-click the output item in the Results window to scroll the output window to the top of that particular output. If you clear the Output window, the links in the Results window are deleted.
Create HTML output

You can set preferences to create LISTING output or HTML output. Your preferences are stored from session to session.


  1. Select Tools -> Options -> Preferences.
  2. Click the Results tab.
  3. Select the Create HTML check box.11
  4. Click OK.


Modify the program

Now that you have seen the output and formatting for the PRINT procedure, let’s try adding options to the program to do these things:

  • remove the date from the top of each page
  • replace the default “The SAS System” title
  • use the column label rather than the column name in the output
  • remove the Obs column.

We can do this by using a SAS system option, a TITLE statement, and options on the PROC PRINT statement.


  1. To remove the date from the top of each page, use the NODATE system option. Copy the following OPTIONS statement and paste it at the top of the program:
    options nodate;
  2. To replace the default title, use the TITLE statement. Copy the following line and add it above the RUN statement for the PRINT procedure:
    title "Product Sales Report";

    By including the TITLE statement in the PROC step, the title is applied to the output of the procedure.

  3. To remove the Obs column and use column labels, use options on the PROC PRINT statement. Change the PROC PRINT statement to add the LABEL and NOOBS options. Your PROC PRINT statement should look like this:
    proc print data=test label noobs;
  4. Your program should look like the one below.
  5. Select Run -> Submit.


View and save the results

You can create HTML results and save them as HTML files.


  1. In the Results Viewer window, scroll the HTML results. You can change the color and style of HTML output by selecting a different style on the Results tab of the Options window.12
  2. With the Results Viewer window active, select File-> Save As. In the File name box, type ProductSales.htm. Click Save.13
  3. Look at the the Results window. Notice that there is a new folder for the results of the program you just ran. The folder name uses the Product Sales Report title that you specified in your program.Double-click the Print: Product Sales Report folder, then double-click Data Set WORK.TEST. There are links to both the listing output and the HTML output.



Save a SAS program and set up a favorite folder

When you save your SAS programs, you can store them in a folder that’s easy to access from the Explorer window.


  1. With the Editor window active, select File-> Save As.
  2. The Save As window opens to a default folder on your system. In the File name box, type prodsales. Click Save. The file is saved with a .sas extension, indicating that it is a SAS program.15
  3. In the Explorer window, double-click Favorite Folders.
  4. Right-click in the Favorite Folders window and select New Favorite Folder.
  5. In the New Favorite Folder window, type SAS programs in the Name box.


  6. Click Browse. The Select window opens to the same default location where you saved the program. Verify that prodsales.sas is in the directory. Click OK to close the Select window.17
  7. Click OK to close the New Favorite Folder window. SAS programs is added to the Favorite Folders window. This gives you a convenient way of accessing your SAS programs.


    Now you’ve learned the basic steps for creating, submitting, and saving SAS programs. In the next section of this quick-start guide, you can choose sample SAS programs to investigate, experiment with, adapt, and save.



See these online resources to learn more about how tocreate and run SAS programs.

Documentation, publications, and FAQs


  • documentation in SAS Help:
    1. In SAS, click Help-> SAS Help and Documentation.
    2. Expand SAS Products-> Base SAS-> SAS Language Reference: Concepts.
    3. Expand DATA Step Concepts-> DATA Step Processing and view topics of interest.
    4. Expand SAS System Concepts-> Error Processing and Debugging and view topics of interest.
    5. Expand SAS System Concepts-> SAS Output and view topics of interest.
    6. Expand DATA Step Concepts->Reading Raw Data and view topics of interest.
  • other publications in SAS Documentation, including SAS Tech Report
    Sample programs
  • programs in SAS Help:
    1. In SAS, click Help->SAS Help and Documentation.
    2. Expand Learning to Use SAS-> Sample SAS Programs-> Base SAS Samples-> Base Usage Guide Examples.
  • programs in SAS Press and SAS Documentation Example Code and Data


adminSAS Series 5: Create and run SAS programs Cont.