BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
D_Z_
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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

3 REPLIES 3
Tom
Super User Tom
Super User

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.

D_Z_
Obsidian | Level 7

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?

Tom
Super User Tom
Super User

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 ;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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