Question

we are using SAS to generate lots of report and save the log in a file. So far so good, everything is working fine except one thing.

We have a macro that check the log files for the words warning and error and if it found those word it put the file in an error folder. The problem we are having is when we import a CSV file with proc import, it automatically put this in the log file :

proc import datafile=XXXXXXXXXX
out=XXXXXXXXXX
dbms=dlm
replace;
delimiter=',';
getnames=yes;
datarow=2;
GUESSINGROWS=1000;
run;

/**********************************************************************
*   PRODUCT:   SAS
*   VERSION:   9.1
*   CREATOR:   External File Interface
*   DATE:      30AUG13
*   DESC:      Generated SAS Datastep Code
*   TEMPLATE SOURCE:  (None Specified.)
***********************************************************************/
data XXXXXXXX;
%let _EFIERR_ = 0; /* set the ERROR detection macro variable */
infile XXXXXXXX delimiter = ',' MISSOVER DSD  firstobs=2 ;
informat XXXXXXXX $5. ;
... code continue
format XXXXXXXX $5. ;
... code continue
input
XXXXXXXX $
... code continue
;
if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
run;

So we are left with a bunch of files that are flagged with an error but they shouldn't be flagged. Any idea on what we could do to hide the proc import code in the log files ?

Thanks

Was it helpful?

Solution

When error checking logs, I only consider ERROR or WARNING on the beginning of the line, e.g.

if index(_infile_, 'ERROR') = 1 ....

Also we have a list of allowed error messages.

If not this, it seems you can hide what IMPORT generates with NOSOURCE option, but it's not very nice.

options nosource;
proc import file='E:\test.csv' out=test replace;
run;
options source;

OTHER TIPS

I have seen several postings suggesting "options nosource" for suppressing the excess output of the proc import or proc export, but I haven't actually seen it work. There is an example posted on the SAS website that shows it failing to work. The page is http://documentation.sas.com but if that link doesn't work search for "sas proc export nosource 02sep16". Notice the numbered lines include the unwanted printout even though nosource is specified among the options.

I am the same way. I grep for ERROR and dont want it showing up!! I see ERROR when using proc input, so for me, this is what solved it.

Use proc input and then copy the log file and edit as needed.

  proc import datafile="file.out"
  out=shoes
  dbms=csv
  replace;

that produces this

28             data WORK.SHOES    ;
29             %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
30             infile 'file.out' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
31                informat QUEUE_ID $8. ;
56                format VAR13 best12. ;
57             input
58                         QUEUE_ID  $
69                         AUTOMATION_STATUS  $
70                         VAR13
71             ;
72             if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
73             run;

I just use that code instead of proc input and remove the lines 29,72...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top