BookmarkSubscribeRSS Feed
Irenech34
Calcite | Level 5

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!

6 REPLIES 6
Reeza
Super User

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?

 

 

Irenech34
Calcite | Level 5

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.

Reeza
Super User

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.

error_prone
Barite | Level 11
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.
Irenech34
Calcite | Level 5

Thank you all very much.

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

 

Reeza
Super User

@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.

 

 

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
  • 1560 views
  • 2 likes
  • 3 in conversation