If
you follow some basic guidelines as you develop a program, then you
can avoid common errors. Use the following checklist to flag and correct
common mistakes before you submit your program.
-
Check the syntax of your program.
In particular, check that the following items are correct:
-
All SAS statements must end with
a semicolon. Make sure that you have not omitted any semicolons or
accidentally entered the wrong character.
-
Any starting and ending quotation
marks must match. You can use either single or double quotation marks.
-
Most SAS statements begin with
a SAS keyword. (Exceptions are assignment statements and Sum statements.)
Make sure that you have not misspelled or omitted any of the keywords.
-
Every DO and SELECT statement must
be followed by an END statement.
-
Check the order of your program.
SAS usually executes
the statements in a DATA step one by one, in the order in which they
appear. After executing the DATA step, SAS moves to the next step
and continues in the same way. Make sure that all the SAS statements
appear in order so that SAS can execute them properly. For example,
an INFILE statement, if used, must precede an INPUT statement.
Also, be sure to end
steps with the RUN statement. This is especially important at the
end of your program because the RUN statement causes the previous
step to be executed.
-
Check your INPUT statement and
your data.
SAS classifies all
variables as either character or numeric. The assignment in the INPUT
statement as either character or numeric must correspond to the actual
values of variables in your data. Also, SAS allows for list, column,
formatted, or named input. The method of input that you specify in
the INPUT statement must correspond with the actual arrangement of
raw data.