The SAS Output Delivery System and reporting techniques

ODS Output NOWARN

Reply
Frequent Contributor
Posts: 79

ODS Output NOWARN

The ODS OUTPUT statement documentation includes NOWARN.  I am scan a large directory and abstracting the metadata of the data sets using the CONTENTS procedure.  Although a SAS data set exists in some directories, it may not have variables or observations.  This occurs through a programming practice I would prohibit in my shop:

 

data test ;

  stop ;

run ;

 

How can I avoid the output variables not created warning?  I have tried variations on:

 

ods output variables = variables ( nowarn ) ;

 

 

Thank you,

 

Kevin

Respected Advisor
Posts: 4,948

Re: ODS Output NOWARN

Sometimes you'll see a hybrid like this:

 

data want;

   stop;

   set have;

run;

 

That gives you a data set with 0 observations, but with all variables defined.  Is it OK to omit the PROC CONTENTS for those too?

Frequent Contributor
Posts: 79

Re: ODS Output NOWARN

Astounding,

 

  Correct, as does my preferred flavor:

 

data want ;

  if 0 then set have ;

run ;

 

(I use this, for instance, when obtaining the attributes for a hash, with a data set KEEP= option as appropriate.)

 

Both of these approaches create variables, assuming that have has variables.  CONTENTS did not "like" the absence of variables, but it reported the metadata with 0 observations.  I cannot control what "data sets" are in the directories.  I even found some files with a .sas7bdat extension that SAS did not recognize and reported something like

 

DM.AE.DATA

 

FWIW, %sysfunc( exist( DM.AE ))  was equal to 1 in that case.  I am not that interested in a "clean" log; I will just acknowledge a priori in the production run that these warnings are acceptable (for this purpose).

 

Thanks,

 

Kevin

Respected Advisor
Posts: 4,948

Re: ODS Output NOWARN

[ Edited ]

Given your answer, I'm not sure if this will be useful or not.  But here's a way to skip PROC CONTENTS when there are 0 observations (regardless of the number of variables).

 

data _null_;

set &whatever;

call execute ("proc contents data=&whatever; run;");

stop;

run;

 

 Also note, if this is your idea of fun, you can create a data set with multiple observations and zero variables:

 

data test;

do i=1 to 10;

   output;

end;

drop i;

run;

Ask a Question
Discussion stats
  • 3 replies
  • 248 views
  • 0 likes
  • 2 in conversation