LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2002, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 30 Apr 2002 10:57:43 +0100
Reply-To:     Peter Crawford <peter.crawford@DB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@DB.COM>
Subject:      Re: Storing Infile error messages in sas dataset
Comments: cc: StatDept@YAHOO.COM
Content-type: text/plain; charset=iso-8859-1

I don't know any short-cut to a sas dataset with the input errors, but I do something like... To capture this info, I re-route the log with proc printto. Then during the input data step, pay attention to _error_. if _error_ then do; put 'errors surfaced on ' row= ; _error_ =0; _err ++1 ; retain _err 0; /* retain statement only foe emphasis */ end; row +1; return; If at any time _error_ becomes non-zero, then the step will (at end of data), call execute() to email that log to those who have to resolve the data errors. The data step uses the column titles of the input file, as variable names, so the columns in error are easily recognised by a business user. By switching off _error_ (after flagging errors are present) the log is not filled with the put _all_ messages and _infile_ . To locate the data causing _error_, the line number and column name (in error) are enough, like: NOTE: Invalid data for B in line 12 3-3. Column position is irrelevant because the data is .csv but easy to ignore (g)

If this is the info to be stored in a dataset of infile errors, it should be simple to parse.

Hope you find the design useful

Regards Peter Crawford

Datum: 30/04/2002 02:25 An: SAS-L@LISTSERV.UGA.EDU

Antwort an: Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>

Betreff: Re: Storing Infile error messages in sas dataset Nachrichtentext:

I'm not sure what you mean. Do you mean that if you have a SAS log that looks like this:

----- 8 data test; 9 infile cards; 10 input a b c; 11 cards;

NOTE: Invalid data for B in line 12 3-3. RULE:----+----1----+----2----+----3----+----4----+- 12 1 b 3 A=1 B=. C=3 _ERROR_=1 _N_=1 NOTE: Invalid data for A in line 13 1-1. NOTE: Invalid data for C in line 13 5-5. 13 a 2 c A=. B=2 C=. _ERROR_=1 _N_=2 -----

You want to capture the fact that B is invalid in the first input line, and A & C are invalid in the second line, along with the locations from which SAS tried to read the values?

If so, I don't know of a straightforward way to do exactly what you want. You could read the input file one field at a time, checking after each read to see if there was a conversion error (a missing value usually indicates a conversion error; in some cases you might have to use the _ERROR_ automatic variable), and using the COLUMN= option on the INFILE statement to track the current location in the input line.

But that could get complicated. If you can switch to formatted or column input mode you won't have to worry about determining the input position, and your task will be easier.

Why do you want to store this information? Why not just look at the SAS log?

-- JackHamilton@FirstHealth.com Manager, Technical Development METRICS Department, First Health West Sacramento, California USA

>>> StatDept <StatDept@YAHOO.COM> 04/29/2002 5:07 PM >>> Hi,

I want to store the field name in the infile error message in a sasdataset to be printed at a later date. Any ideas?

-SH

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


Back to: Top of message | Previous page | Main SAS-L page