BookmarkSubscribeRSS Feed
Doc_Duke
Rhodochrosite | Level 12

Hi,

I am doing some ETL and am writing monthly reports on inconsistent data in some data files I receive.  The reports are being send out as e-mail as a step in the project.  If the data are perfect, there is nothing to list.  Currently the list task does not generate any output (using ODS to RTF file).  That BREAKS the link to the e-mail.  Which would be OK, until the next month when there might be bad data again.  I am using EG 5.1 and SAS 9.3.

Is there some option for the task or project that would force it to print?

I think that I could use %sysnobs to write some macro code to force printing, but I has hoping for something less klugy.

Thanks,

Doc Muhlbaier

Duke

3 REPLIES 3
SteveDenham
Jade | Level 19

Doc,

Suppose the emailed file is baddata.sas7bdat.  Could you append it to a dataset that had only the current date as a record, and then send the concatenated set?  That way there would always be something in the concatenated set, the email would be sent, plus the first record would always be the date of creation.

Steve Denham

Astounding
PROC Star

If you are using PUT statements to generate the contents of the email, the same DATA step could easily perform the needed tasks ...

Find the number of observations in the exceptions data.

Use an IF/THEN statement to write an appropriate message when there are 0 observations.

OS2Rules
Obsidian | Level 7

You can count the records in the data set using a SQL:

PROC SQL;

CREATE TABLE WANT AS

SELECT COUNT(*) AS COUNTER

FROM source.table;

QUIT;

RUN;

This will set variable &SQLOBS to the number of rows the SQL processed.

You then query this value in a DATA step and perform action - if zero to something, else print report.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1060 views
  • 0 likes
  • 4 in conversation