How to show errors or warnings in Out screen but NOT only in log?

Reply
New Contributor
Posts: 4

How to show errors or warnings in Out screen but NOT only in log?

Hello,

I would like to ask how to output the warning when data format is incorrect? The warning is to be printed in Out screen or Results Viewer Screen or a popped out window screen, not Log, because there are a lot of information shown in the Log.

 

My data(AA) looks like this:

 

ID       birth             Transfer

01  02/30/1997           .

02  05/23/1992     1992-05-23 

 

I want to show the following information

_ERROR_=1 ; WARNING! INVALID DATE FOR SAS; data=AA, ID=01, birth=02/30/1997

 

Thanks for your help!

Super User
Posts: 23,700

Re: How to show errors or warnings in Out screen but NOT only in log?

Posted in reply to Irenech34

Where exactly do you want this output?

In the Results Pane?

 

That'll be a manual process, whereas the log could be directed to a file instead?

 

 

New Contributor
Posts: 4

Re: How to show errors or warnings in Out screen but NOT only in log?

How about showing this in Results Viewer Screen?
I don't need the full log but just the error messege.
The warning information should be specific, and need to identify for which SAS dataset, for which record (row), for which variable (column), and the data with wrong date value.

Super User
Posts: 23,700

Re: How to show errors or warnings in Out screen but NOT only in log?

Posted in reply to Irenech34

The simplest approach - note the records via a flag and then use PROC PRINT to display the results to the log. 

However, each check is manual so you will have to code this how you want it to look.

Regular Contributor
Posts: 213

Re: How to show errors or warnings in Out screen but NOT only in log?

Posted in reply to Irenech34
Afaik no automatism exists. The problem can be solved by maintainig a log-dataset and printing it at the end of the process/program. Have a look at log4sas - unfortunately the macros can only write to a file, but import + print are easy to code and you don't have to create the steps for appending to a log datasets yourself.
New Contributor
Posts: 4

Re: How to show errors or warnings in Out screen but NOT only in log?

Posted in reply to error_prone

Thank you all very much.

So you means to save the log then import again and using proc print to print what I want?

 

Super User
Posts: 23,700

Re: How to show errors or warnings in Out screen but NOT only in log?

Posted in reply to Irenech34

Irenech34 wrote:

Thank you all very much.

So you means to save the log then import again and using proc print to print what I want?

 


That's one approach. 

 

Another is to save the errors in a data set themselves and then print that out. 

The first approach only works if a SAS 'error' is the same as your error definition, which I don't think is true.

 

 

Ask a Question
Discussion stats
  • 6 replies
  • 146 views
  • 2 likes
  • 3 in conversation