SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

 

Editing and Debugging SAS Programs
Lesson Summary

 

This page contains


Text Summary

To go to the page where a task, programming feature, or concept was presented, select a link.


Including a Stored SAS Program
A SAS program stored in an external file can be included (copied) into the Program Editor window using

Editing SAS Programs
SAS programs are made of SAS statements. Although you can write SAS statements in almost any format, a certain layout enhances readability and enables you to understand the program's purpose.

The Program Editor window enables you to edit your programs just as you would with a word processing program. You can also use text editor commands and block text editor commands to edit SAS programs. Activating line numbers may make it easier for you to edit your program regardless of your operating environment.

Remember that SAS statements disappear from the Program Editor window when submitted. However, you can recall a program to the Program Editor window.

 

Clearing SAS Programming Windows
Text and output accumulate in the Program Editor, Log, and Output windows throughout your SAS session. You can clear windows by selecting Edit   Clear All.

Interpreting Error Messages
When a SAS program with errors is submitted, error messages appear in the Log window. SAS can detect five types of errors: syntax, semantic, execution-time, data and macro related. This lesson focuses on identifying and resolving  common syntax errors.

Correcting Errors
To modify programs with problems, you need to recall the submitted statements to the Program Editor window, where you can correct the errors.

Before resubmitting a revised program, it's a good idea to clear the messages from the Log window so you don't confuse old messages with the new. You can delete any error-free steps from a revised program before resubmitting it.

Resolving Common Problems
You may need to resolve several types of common problems: missing RUN statements, missing semicolons, unbalanced quotes, and invalid options.

 

Points to Remember
  • It's a good idea to begin DATA steps, PROC steps, and RUN statements on the left and indent statements within a step.

  • End each step with a RUN statement.

  • Review the messages in the Log window each time you submit a SAS program.

  • You can delete any error-free steps from a revised program before resubmitting it.


back||next

 

Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement