04-29-2013 12:21 PM
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.
04-29-2013 12:29 PM
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.
04-29-2013 12:50 PM
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.
04-29-2013 01:46 PM
You can count the records in the data set using a SQL:
CREATE TABLE WANT AS
SELECT COUNT(*) AS COUNTER
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.