DATA Step, Macro, Functions and more

Invalid data error

Not applicable
Posts: 0

Invalid data error


We receive a file from external source system. We read the external file (ebcdic) with a layout and create SAS datasets.
Some times, the file layout is getting changed by the source system which was not trapped by the SAS program. Our SAS program ran fine (with invalid data errors in the log file). Later we came to know about the layout change and when we printed few impacted variables, they were populated with junk values.

Can anyone suggest me a best way to identify if there are junk values in the input file? Again we cannot check each and every variable for valid numeric or character as there are 1000s of variables in the input file.

I cannot afford to abend the program if _ERROR_=1 also.

Any help is well appreciated
Frequent Contributor
Posts: 106

Re: Invalid data error

Posted in reply to deleted_user
Does _error_=1 happen in the data step reading the EBCDIC input file?
If yes, you might redirect erroneous records to an "alert" type of file and react to the file's mere existence any way you want.

Somewhat like:
filename alert "file_xyz_alert_&sysdate..txt" ;
data ... ;
if _error_=1 then do ;
file alert ;
put _infile_ ;
_error_ = 0 ;
end ,
run ;

Be aware however that this method may trap other errors as well.

Super Contributor
Super Contributor
Posts: 3,176

Re: Invalid data error

Posted in reply to Robert_Bardos
You can use any one of the CHARACTER type call functions to check your SAS variable values, as needed. And based on the variable test results, optionally take action, such as sending an EMAIL with a summary report or some type of evidence revealed.

Scott Barry
SBBWorks, Inc.
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation