BookmarkSubscribeRSS Feed
Natalie
Calcite | Level 5

Dear all,

I’m currently working on my program, which processes ANCOVA analysis by PROC MIXED in a loop. Some models are running correctly, some with warnings in the LOG.

Is there a way to check which one run with warning, which not?

I tried the macro variable SYSWARNINGTEXT, but when it  was set once to the warning text, it keeps the message for the subsequent PROC MIXED runs in a loop, even when they run correctly.

Thank you,

Natalie

6 REPLIES 6
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

I have seen several different methods when analyzing logs.  My personal preference is to have a separate utility which you can drop a log onto and that provides a report on errors/warnings/notes found.  Note this is a custom built tool I wrote however you could do something similar in SAS.   I built a small .NET app which you can drag text files onto the icon and it will scan them for known issues from another text file.

You could wrap each procedure up in some additional code to check the outcome, but its a bit a of work and is it really worth the effort when you can just check the output log.

If your running interactively then run each step individually, if you run the whole program direct logs to a file then scan that file (this would also go further if your automating things, then the log could be automatically scanned).

Also, you need to be clear on what you are looking for as its not only errors/warnings which could trip you up, there are logical errors and some notes could also impact.

Natalie
Calcite | Level 5

Hi Kurt,

thanks for your reply. The SYSCC seems to work with "regular" warnings, but somehow it doesn't pick up the warning from PROC MIXED "More coefficients specified...".

We are running about 600 ANCOVA models and I wanted to flag those which produce this warning.

Natalie

Kurt_Bremser
Super User

When the "warnings" do not change the value of &SYSCC (and SAS technical support can't come up with a better solution), then some method that checks the log will be necessary.

You could run each model in a different batch job, producing individual logs, and check these with tools like grep

Or you could wrap it all in a single program, use PROC PRINTTO in each iteration to let each step write into a separate external file, and check this log with a DATA step.

jakarman
Barite | Level 11

syserr is associacted with syswarning SAS(R) 9.4 Macro Language: Reference  it should give the value to the syscc.
As this does not happen SAS is not working conform his own documented error-handling concepts. I am convinced they should correct that.  

SAS(R) 9.4 Language Reference: Concepts, Second Edition

This paper is giving some info on notes    http://support.sas.com/resources/papers/proceedings12/332-2012.pdf

I was looking for a special option for error handling or macro-var as seen with other procs.

As by-pass you could do a analyses on logging output, but in the newer user interfaces (SAS studio 3,  Eguide 6.1, web-based, BI server/client) this approach is getting discouraged.
Only in old habit having your own open desktop a lot of this is still well allowed. The reason is:  working with files on the OS level is seen as the problem  (xcmd lockdown etc). 

---->-- ja karman --<-----
FlorentMothere
Calcite | Level 5
Old subject but often encountered.. It's possible to check the warning message and reinitialize the message. The syscc or syserr symbolic variables are not systematically set to another value than 0 in case of warning, so it could be impossible to pilote the warning message in conjunction with these variables. Further more, the syswarningtext is never reinitialize and can't be modify (read only value). A solution to circumvent the problem is to generated his own Warning Example : %macro WarningControle; %if %bquote(&SYSWARNINGTEXT) ne %str( ) %then %do; %put ERROR: Warning is here ! ; /* reinit */ %put WARNING: %str( ); %end; %else %put NOTE: No warning; %mend WarningControle; %put &=SYSWARNINGTEXT; axis1 label=(a=90 'Sum Age') order=(0 to 20 by 5) value=("0" "10" "20") ; proc gchart data = sashelp.class ; vbar sex / sumvar = age raxis=axis1 ; run; %put &=SYSWARNINGTEXT; %WarningControle %put &=SYSWARNINGTEXT; proc gchart data = sashelp.class ; vbar sex / sumvar = age raxis=axis1 /* Correction */ type=mean ; run; %WarningControle %put &=SYSWARNINGTEXT; SAS LOG : 23 %macro WarningControle; 24 %if %bquote(&SYSWARNINGTEXT) ne %str( ) 25 %then %do; 26 %put ERROR: Warning is here ! ; 27 /* reinit */ 28 %put WARNING: %str( ); 29 %end; 30 %else %put NOTE: No warning; 31 %mend WarningControle; 32 33 %put &=SYSWARNINGTEXT; SYSWARNINGTEXT= 34 35 axis1 label=(a=90 'Sum Age') order=(0 to 20 by 5) value=("0" "10" "20") ; 36 37 proc gchart data = sashelp.class ; 38 vbar sex / sumvar = age raxis=axis1 ; 39 run; WARNING: One or more bars in the VBAR chart of Sex were clipped to the range of the specified response axis. 40 41 %put &=SYSWARNINGTEXT; SYSWARNINGTEXT=One or more bars in the VBAR chart of Sex were clipped to the range of the specified response axis. 42 43 %WarningControle ERROR: Warning is here ! WARNING: 44 45 %put &=SYSWARNINGTEXT; SYSWARNINGTEXT= 46 NOTE: There were 19 observations read from the data set SASHELP.CLASS. NOTE: PROCEDURE GCHART used (Total process time): real time 0.06 seconds cpu time 0.02 seconds 47 proc gchart data = sashelp.class ; 48 vbar sex / sumvar = age raxis=axis1 /* Correction */ type=mean ; 49 run; 50 51 %WarningControle NOTE: No warning 52 53 %put &=SYSWARNINGTEXT; SYSWARNINGTEXT=

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 2258 views
  • 3 likes
  • 5 in conversation