Previous Page | Next Page

Saving Source Code for Editing and Re-execution

Working with Source Code


Creating Source Code

The following steps instruct you to generate a listing report and then save the programming statements that are generated for that listing report. For more detailed instructions on how to produce a listing report, refer to Report Writing.

  1. SelectTasks [arrow] Report Writing [arrow] ListingThe List a Table window appears.

  2. If the active table is SASUSER.HOUSES, then continue to the next step. Otherwise, select Table, and then select the SASUSER.HOUSES table. For more information on selecting tables, see Selecting a Table.

  3. If there is an active Subset Data selection (indicated by BY, WHERE, or ROWS next to Subset data), then follow the directions in Clearing a Subset Data Selection.

  4. If other report selections exist (for example, column names are listed for Columns), then selectFile [arrow] Newto clear these selections.

  5. If desired, run the report by selectingRun [arrow] SubmitThe Listing Report appears in the Output window. Note that it is not necessary to run a task before saving its source code.

  6. Return to the List a Table window by using one of the following methods, depending on your operating environment:

    • Use the PREVWIND function key.

    • Click on the SAS/ASSIST window.


Viewing Source Code

The steps in this section enable you to look at the program that was created by SAS/ASSIST software when you produced the listing report.

  1. From the List a Table window, selectView [arrow] View sourceThe program that was created when you made the listing report task window selections appears.

    Program for Creating Listing Report

    [Program for Creating Listing Report]

  2. Use the scroll bars or the FORWARD, BACKWARD, LEFT, and RIGHT function keys to view the program.

  3. When you finish looking at the program, selectFile [arrow] Closeto return to the List a Table window.


Saving Source Code

The steps in this section enable you to save the program that produced the listing report so that you can edit it or re-execute it at a later time.

  1. Follow this selection path from the List a Table window:File [arrow] Save as sourceThe Save As window appears.

    Save As Window

    [Save As Window]

  2. In the Name field, type the name you want to call the program. For this example, type HOUSERPT as the program name.

    A program name can be one to eight characters in length. It must start with a letter (A through Z) or an underscore (_), but it can otherwise contain any combination of letters, numbers, and underscores.

  3. In the Description field, type a description of the program. The Description can be up to 32 characters in length and contain any combination of letters, numbers, and other characters. For this example, type Listing of the Houses Table .

  4. The default catalog for saved source code is called SASUSER.PRIVATE, as shown in the previous display. If you want to save the source code in a different catalog, type the catalog name in the Catalog field. For a list of available catalogs, type a question mark (? ) in the Catalog field and press ENTER to display a list of available catalogs. You can select one from this list.

  5. Select OK to return to the List a Table window. A note appears in the message area to indicate that the program has been successfully saved.


Editing and Re-executing Source Code

You can use the Result Manager to edit and re-execute the program that you saved in the previous section. For more information on the Result Manager, see Using the Result Manager.

  1. SelectTools [arrow] Result Managerto invoke the Result Manager. The Result Manager window appears with a list of your saved tasks, output, and programs.

  2. Position the cursor in the space to the left of HOUSREPT. Type E (or S ) and press ENTER. The Edit window appears with your program.

    Edit Window

    [Edit Window]

  3. Position the cursor over the semicolon (;) in the line with the footnote statement. Add a footnote by pressing the SPACE BAR, and then typing

    SASUSER.HOUSES.DATA;

    as shown in the following display.

    Modified Source Code

    [Modified Source Code]

  4. SelectFile [arrow] Closeto save the edited program and return to the Result Manager window. A prompt appears asking if you want to save the changes to the program. Select Yes.

  5. In the Cmd field for HOUSREPT, type X and press ENTER to re-execute the program and view the footnote you added.

    Modified Listing Report Output

    [Modified Listing Report Output]

  6. To return to the Result Manager window from the Output window, use one of the following methods, depending on your operating environment:

    • Use the PREVWIND function key.

    • Click on the SAS/ASSIST window.

  7. From the Result Manager window, select File [arrow] Closeto return to the List a Table window.


Exiting This Task

When you are ready to return to the WorkPlace menu or move on to another task, follow the directions in Exiting a Task.

Previous Page | Next Page | Top of Page