This section illustrates the kinds of messages you might see in the log window when you have unbalanced quotation marks.
Example 8.7 Section
As should be fairly obvious by the coloration of the code, the following program is missing a closing quotation mark in the PRINT procedure's first TITLE statement:
DATA trees;
input type $ 1-16 circ_in hght_ft crown_ft;
DATALINES;
oak, black 222 105 112
hemlock, eastern 149 138 52
ash, white 258 80 70
cherry, black 187 91 75
maple, red 210 99 74
elm, american 229 127 104
;
RUN;
PROC PRINT;
var type circ_in hght_ft;
title 'Some trees in Kentucky
title2 'Division of Forestry';
RUN;
DATA trees;
input type $ 1-16 circ_in hght_ft crown_ft;
DATALINES;
NOTE: The data set WORK.TREES has 6 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
;
RUN;
PROC PRINT;
var type circ_in hght_ft;
title 'Some trees in Kentucky
title2 'Division of Forestry';
RUN;
If you launch and run the SAS program, you should see that no output is generated, and in the top blue bar of the SAS window, you should notice that the PRINT procedure continues to run:
That's because when SAS encountered the unbalanced quotation marks in the first TITLE statement, it continued to look for the closing quotation mark and in the process swallowed up the PRINT procedure's closing RUN statement.
Unfortunately, simply adding a quotation mark, and resubmitting your program typically does not solve the problem. SAS still considers the quotation marks to be unbalanced. (You might want to convince yourself that this is indeed true by adding the quotation mark to the end of the first TITLE statement and resubmitting the program.)
Instead, you must first cancel the errant program before you correct and resubmit the program. These are the specific steps that you need to take in this situation:
Anywhere in your program, type an asterisk followed by a quotation mark, a semicolon, and a RUN statement with a closing semicolon:
*'; RUN;
- Use your cursor to select just the line of code that you typed. Then, submit just that line of code by clicking on the running man .
Delete the line of code that contains the asterisk followed by a quotation mark, a semicolon, and a RUN statement with a closing semicolon:
*'; RUN;
- Insert the missing quotation mark in the appropriate place in the program.
- Submit the corrected program.
You should go ahead and follow these steps for our program to convince yourself that the steps work. Then, when all is said and done, you should look at the log window to see the two warning messages that SAS displays about the "quoted-string has more than 262 characters" and "the TITLE statement is ambiguous due to invalid options or unquoted text."
Whenever SAS behaves in the way described in this section, the first thing you should suspect is unbalanced quotation marks. Then, you'll want to make sure you resolve the problem as soon as it occurs. Otherwise, it is likely that any subsequent programs that you submit in the current SAS session will generate errors.