Desktop productivity for business analysts and programmers

Report with no dataset

Accepted Solution Solved
Reply
Contributor
Posts: 70
Accepted Solution

Report with no dataset

Mabye someone can lend some advice here.  I am using SAS to run an interval report hourly that auto emails to a dist list.

I run 4 different summary statistics reports, join them into one report report, export them to pdf and email them to a distribution list hourly throughout the day.  It's an automated process that i have running on my system.

What is happening is that one of the reports sometimes has an empty dataset, and therefore when the automated process runs, it doesn't generate anything for that statistics summary table and the report ends up with the prior hours information, which is confusing my audience.

Is it possible to force the summary statistics to run even though the dataset is empty, instead of having information from a prior interval?  Any suggestions would be helpful.

Thanks,

Dean


Accepted Solutions
Solution
‎03-29-2013 06:47 PM
Super User
Super User
Posts: 6,842

Re: Report with no dataset

Without seeing how you are currently doing it is hard to make an informed suggestion.

In the old days we would just use a DATA _NULL_ step.  For example if you were using PROC REPORT to make the report you could preceed with a data _null_ step.

ods pds file='step1.pdf';

data _null_;

  if nobs=0 then do;

    file print;

    put 'No data for this report';

   end;

  stop;

  set report1 nobs=nobs ;

run;

proc report data=report1 .......

............

ods pdf close ;

View solution in original post


All Replies
Super User
Super User
Posts: 6,842

Re: Report with no dataset

Let me see if I understand the problem.

You are generating the report to a file?  And since the input is empty the step doesn't run so the file isn't overwritten?

Depends on how you are generating the reports, but in general you should add a step to write a dummy report before the one that makes the real report.

Then if the step doesn't overwrite it they get the dummy report instead of the report from the previous successful run.

Contributor
Posts: 70

Re: Report with no dataset

Okay... that's makes sense.  I am not familiar with how to create that kind of step.  Is there a resource that you could recommend that would walk me through that process?

Solution
‎03-29-2013 06:47 PM
Super User
Super User
Posts: 6,842

Re: Report with no dataset

Without seeing how you are currently doing it is hard to make an informed suggestion.

In the old days we would just use a DATA _NULL_ step.  For example if you were using PROC REPORT to make the report you could preceed with a data _null_ step.

ods pds file='step1.pdf';

data _null_;

  if nobs=0 then do;

    file print;

    put 'No data for this report';

   end;

  stop;

  set report1 nobs=nobs ;

run;

proc report data=report1 .......

............

ods pdf close ;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 396 views
  • 0 likes
  • 2 in conversation