
run;
proc chart data=out.error1;
hbar test / sumvar=TestScore type=mean group=gender discrete;
run;
The following output shows the result of the two syntax errors:
Log 25.1 Diagnosing Syntax Errors: Missing Semicolon and Misspelled Keyword
11 libname out 'your-data-library';
NOTE: Libref OUT was successfully assigned as follows:
Engine: V9
Physical Name: your-data-library
12
13 data out.error1
14 infill 'your-input-file';
15 input test $ gender $ year TestScore;
16 run;
ERROR: No DATALINES or INFILE statement.
ERROR: Extension for physical file name "your-input-file" does not
correspond to a valid member type.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set OUT.ERROR1 may be incomplete. When this step was stopped
there were 0
observations and 4 variables.
WARNING: Data set OUT.ERROR1 was not replaced because this step was stopped.
WARNING: The data set WORK.INFILL may be incomplete. When this step was stopped
there were 0
observations and 4 variables.
WARNING: Data set WORK.INFILL was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
17
18 proc chart data=out.error1;
19 hbar test / sumvar=TestScore type=mean group=gender discrete;
20 run;
NOTE: No observations in data set OUT.ERROR1.
NOTE: PROCEDURE CHART used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
As the log indicates, SAS recognizes the keyword DATA and attempts to process the
DATA step. Because the DATA statement must end with a semicolon, SAS assumes that
INFILL is a data set name, and that two data sets are being created: OUT.ERROR1 and
WORK.INFILL. Because SAS considers INFILL the name of a data set, it does not
recognize it as part of another statement, and therefore does not detect the spelling error.
Because the string in quotation marks is invalid in a DATA statement, SAS stops
processing here and created no observations for either data set.
SAS attempts to execute the program logically based on the statements that it contains,
according to the steps outlined earlier in this section. The second syntax error, the
misspelled keyword, is never recognized because SAS considers the DATA statement to
be in effect until a semicolon ends the statement. The point to remember is that when
multiple errors are made in the same program, not all of them might be detected the first
time the program is executed. Errors might also be flagged differently in a group than if
Diagnosing Errors 403