I've always had trouble figuring out what any variety of SAS error and warning messages mean. Can anyone shed light on what the bolded, green numbers in the text below refer to? Are these line numbers? Observation numbers? Specific error codes? Is there anyway to get SAS to point you to a specific problematic value in a data set (or at least the first problematic value in a series of problematic values?
MPRINT(CHECK_RANGE): *Item 20 -- iadtdy; MPRINT(CHECK_RANGE): * Note that the 1 to 31 is on purpose, regardless of month; MPRINT(CHECK_RANGE): if iadtdy ~in(.,98,99) & (iadtdy<1 | iadtdy>31) then do; MPRINT(CHECK_RANGE): badvar="oiadtdy"; MPRINT(CHECK_RANGE): badval=trim(left(put(iadtdy,best.))); MPRINT(CHECK_RANGE): output out_of_range; MPRINT(CHECK_RANGE): end; MPRINT(CHECK_RANGE): *Item 20 -- iadtyr; MPRINT(CHECK_RANGE): *Items 21, 23, 25 -- Filing charge #1 through filing charge #3; MPRINT(CHECK_RANGE): length newfichrg1 newfichrg2 newfichrg3 $3; MPRINT(CHECK_RANGE): *array fc_str[&n_fccode] $ _temporary_ (&fc_v_list); SYMBOLGEN: Macro variable FC_O_LIST resolves to FICHRG1 FICHRG2 FICHRG3 FICHRGDESC1 MPRINT(CHECK_RANGE): array fc_orig[*] FICHRG1 FICHRG2 FICHRG3 FICHRGDESC1 ; SYMBOLGEN: Macro variable FC_N_LIST resolves to newfichrg1 newfichrg2 newfichrg3 newfichrg. NOTE: Line generated by the macro variable "FC_N_LIST". 2039 newfichrg1 newfichrg2 newfichrg3 newfichrg. __________ 22 201 ... MPRINT(CHECK_RANGE): *Item 62 -- ultdisdtdy; MPRINT(CHECK_RANGE): * Note that the 1 to 31 is on purpose, regardless of month; MPRINT(CHECK_RANGE): if ultdisdtdy ~in(.,98,99) & (ultdisdtdy<1 | ultdisdtdy>31) then do; MPRINT(CHECK_RANGE): badvar="oultdisdtdy"; MPRINT(CHECK_RANGE): badval=trim(left(put(ultdisdtdy,best.))); MPRINT(CHECK_RANGE): output out_of_range; MPRINT(CHECK_RANGE): end; MPRINT(CHECK_RANGE): *Item 62 -- ultdisdtyr; MPRINT(CHECK_RANGE): output a1; MPRINT(CHECK_RANGE): run; ERROR 22-322: Syntax error, expecting one of the following: a name, (, -, :, ;, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_. ERROR 201-322: The option is not recognized and will be ignored. NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 2039:228 2039:42 NOTE: The SAS System stopped processing this step because of errors. NOTE: Due to ERROR(s) above, SAS set option OBS=0, enabling syntax check mode. This prevents execution of subsequent data modification statements. WARNING: The data set WORK.A1 may be incomplete. When this step was stopped there were 0 observations and 154 variables. WARNING: The data set WORK.OUT_OF_RANGE may be incomplete. When this step was stopped there were 0 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.17 seconds cpu time 0.14 seconds
Those are the internal numbers SAS uses to represent that type of error.
In the log they kind of work like a footnote in an scientific paper.
Of the jargon you hear TV police officers use on the radio. "Hey dispatch we have 22 in progress at CHECK_RANGE".
Is that the full unedited log?
Usually it shows the code and how it resolves the macro variable but in this case it just shows the variable list and I don't see the variable referenced in the code which is strange to me.
@raivester wrote:
I've always had trouble figuring out what any variety of SAS error and warning messages mean. Can anyone shed light on what the bolded, green numbers in the text below refer to? Are these line numbers? Observation numbers? Specific error codes? Is there anyway to get SAS to point you to a specific problematic value in a data set (or at least the first problematic value in a series of problematic values?
MPRINT(CHECK_RANGE): *Item 20 -- iadtdy; MPRINT(CHECK_RANGE): * Note that the 1 to 31 is on purpose, regardless of month; MPRINT(CHECK_RANGE): if iadtdy ~in(.,98,99) & (iadtdy<1 | iadtdy>31) then do; MPRINT(CHECK_RANGE): badvar="oiadtdy"; MPRINT(CHECK_RANGE): badval=trim(left(put(iadtdy,best.))); MPRINT(CHECK_RANGE): output out_of_range; MPRINT(CHECK_RANGE): end; MPRINT(CHECK_RANGE): *Item 20 -- iadtyr; MPRINT(CHECK_RANGE): *Items 21, 23, 25 -- Filing charge #1 through filing charge #3; MPRINT(CHECK_RANGE): length newfichrg1 newfichrg2 newfichrg3 $3; MPRINT(CHECK_RANGE): *array fc_str[&n_fccode] $ _temporary_ (&fc_v_list); SYMBOLGEN: Macro variable FC_O_LIST resolves to FICHRG1 FICHRG2 FICHRG3 FICHRGDESC1 MPRINT(CHECK_RANGE): array fc_orig[*] FICHRG1 FICHRG2 FICHRG3 FICHRGDESC1 ; SYMBOLGEN: Macro variable FC_N_LIST resolves to newfichrg1 newfichrg2 newfichrg3 newfichrg. NOTE: Line generated by the macro variable "FC_N_LIST". 2039 newfichrg1 newfichrg2 newfichrg3 newfichrg. __________ 22 201 ... MPRINT(CHECK_RANGE): *Item 62 -- ultdisdtdy; MPRINT(CHECK_RANGE): * Note that the 1 to 31 is on purpose, regardless of month; MPRINT(CHECK_RANGE): if ultdisdtdy ~in(.,98,99) & (ultdisdtdy<1 | ultdisdtdy>31) then do; MPRINT(CHECK_RANGE): badvar="oultdisdtdy"; MPRINT(CHECK_RANGE): badval=trim(left(put(ultdisdtdy,best.))); MPRINT(CHECK_RANGE): output out_of_range; MPRINT(CHECK_RANGE): end; MPRINT(CHECK_RANGE): *Item 62 -- ultdisdtyr; MPRINT(CHECK_RANGE): output a1; MPRINT(CHECK_RANGE): run; ERROR 22-322: Syntax error, expecting one of the following: a name, (, -, :, ;, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_. ERROR 201-322: The option is not recognized and will be ignored. NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column). 2039:228 2039:42 NOTE: The SAS System stopped processing this step because of errors. NOTE: Due to ERROR(s) above, SAS set option OBS=0, enabling syntax check mode. This prevents execution of subsequent data modification statements. WARNING: The data set WORK.A1 may be incomplete. When this step was stopped there were 0 observations and 154 variables. WARNING: The data set WORK.OUT_OF_RANGE may be incomplete. When this step was stopped there were 0 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.17 seconds cpu time 0.14 seconds
As Tom said, they're pretty much internal (to SAS) error codes, not really documented or useful to programmers AFAIK.
Note that this a compile-time error, so other than indicating the bit of code with the error (which it does here by underlining the bad code) and telling you what it expects to find there, I'm not sure what else it could tell you.
I think it's doing a fair job of telling you that you've written a dot somewhere it is not expected, as in:
1 data _foo_ ; 2 array x{*} a b c. ; -- 22 201 ERROR 22-322: Syntax error, expecting one of the following: a name, (, -, :, ;, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_. ERROR 201-322: The option is not recognized and will be ignored. 3 run ;
Not sure why you are asking about "problematic values in a data set" as the errors in your SAS log relate to incorrect SAS language syntax and are nothing to do with problematic data. If you have a large SAS log then you can easily step through the error messages using the - Cntrl E - key combination to locate where your errors are.
In addition to other comments you want to watch comment usage like this in macros:
MPRINT(CHECK_RANGE): *Item 20 -- iadtdy; MPRINT(CHECK_RANGE): * Note that the 1 to 31 is on purpose, regardless of month;
If your macro code contains inline comments that start with * and end (hopefully) with a ; then you need to be aware that they are not comments to the macro compiler and may actually execute or resolve in a call that you may not expect.
Macro comments should be either %* <text to comment> ; or the /* <text to comment> */ style.
As an example:
%macro commentexample (dsn= ); * %put %quote(&dsn.) is the dataset ; proc print data=&dsn.; run; %mend; %commentexample(dsn=sashelp.class)
You might think the %put is commented and would not execute. But checking log we see:
313 %commentexample(dsn=sashelp.class) sashelp.class is the dataset
Which is not much of a problem. But suppose you had "commented out" code that called macro statements to delete a file? Or change the value of a parameter? You could be spending hours trying to figure out why the file disappeared or the wrong the value is used somewhere. {Go ahead, guess just how I learned this.}
The posted example macro looks like the exact right use for statement comments inside a macro.
Notice how the comment appears in the log as an MPRINT line along side the other lines of SAS code the macro generated.
Now someone trying to read the log has information about WHY those lines of code are being generated.
Macro comments or a block comments in your macro definition are for the person reading the source code.
The statement comments are for the person reading the SAS log.
@SASKiwi wrote:
If you have a large SAS log then you can easily step through the error messages using the - Cntrl E - key combination to locate where your errors are.
Important note: That Ctrl E keyboard shortcut applies to SAS Enterprise Guide (and maybe other user interfaces that I don't use). In the traditional SAS Display Manager interface, however, Ctrl E would (by default, under Windows) clear the log, which can be a disaster, especially for a large SAS log.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Lock in the best rate now before the price increases on April 1.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.