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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 673 views
  • 0 likes
  • 4 in conversation