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

Hi everyone,

I hope somebody encountered with it or maybe knows how to fix it.

Here is my issue. I am generating a lot of reports every month with XLS and PDF outputs. I have no issues when I get "hits" and results are recorded in PDF outputs. However, when the results "return 0" (meaning I do not have any records) - I still get previous result from the last month (for instanse) in the "Results window and it gets recorded into PDF output.

So, my question is - Does anyone knows how to refresh the "results window" every time the code runs?

I have tried already many options in my code and researched the issues, but can't find solution to it:

1. ods output clear;
2. dm 'odsresults; clear';;
- but nothing seems to work. 

 

Could someone help me with it if you know what could be the issue? I have attached the document with picture for better understanding of the issue.

 

Thanks

Michael

1 ACCEPTED SOLUTION

Accepted Solutions
misha
Fluorite | Level 6

Actually, when you mention condition... I just added one for the previous step to "validate" the result and it seems to work even better...

This way it is not runing the next step at all and doesn't produce PDF...

 

I will go with this solution for now.

 

Thanks for the idea I completelly forgot about doing it this way...

View solution in original post

7 REPLIES 7
collinelliot
Barite | Level 11

My two cents... The issue is probably more that you need to delete the previous intermediate data sets. SAS might not find results, but if there's some intermediate set with data from the previous month, it will go forward with that. I'd recommend a proc datasets to delete at the very least the data sets that directly feed the PDF. Also, if you're generating a ton of documents, I'd probably wrap and ODS noresults; ODS results; around my reporting code and just access the PDFs from whereever you send them with your "file = ...."

misha
Fluorite | Level 6

Hi collinelliot,

 

 

 

collinelliot
Barite | Level 11

I'd have to see your code to help further. What you might want/need to add is some conditional logic that only outputs the report if there is valid data. I'm assuming this is all within a macro, so it would be easy. 

misha
Fluorite | Level 6

Here is the code and there is nothing fancy that I know of in it...

 

ODS ESCAPECHAR='^'; /* for separation purposes */

 

proc report nowd data=work.fndg_dlate_today_int HEADLINE CENTER style(hdr)=[height=.5in];

 

%let todate = %sysfunc(today(),mmddyy10.);

 

title bold "Findings Days Late - Due: &todate";

 

col 'days late'n 'due date'n 'result id'n 'asmt title'n 'Business Unit'n Description 'org info'n 'qa evaluator'n;

 

define 'days late'n / center style(column)=[color=red font_size=2 font_weight=bold width=.4in];
define 'due date'n / center style(column)=[width=.5in];
define 'result id'n / center style(column)=[width=.5in color=darkblue font_size=2 font_weight=bold];
define 'asmt title'n / style(column)=[width=1.2in];
define 'Business Unit'n / style(column)=[width=1.2in];
define 'org info'n / style(column)=[width=1.4in];
define Description / style(column)=[width=4in];

 

options orientation=landscape topmargin=.25in bottommargin=.25in leftmargin=.25in rightmargin=.25in;
options nodate;

 

footnote "Generated by Quality Assurance on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";

 

run;

 

 

collinelliot
Barite | Level 11

It's not the proc report portion that's causing the issue, I'm thinking. What leads up to "work.fndg_dlate_today_int?" I'm assuming at some point there's a failed data step and this data set simply keeps the data from the last successful run. And is this wrapped within a macro? I would assume it is. What do you see in the log between a correct run and one where it just repeats the previous results?

misha
Fluorite | Level 6

Actually, when you mention condition... I just added one for the previous step to "validate" the result and it seems to work even better...

This way it is not runing the next step at all and doesn't produce PDF...

 

I will go with this solution for now.

 

Thanks for the idea I completelly forgot about doing it this way...

collinelliot
Barite | Level 11

Great. Good luck.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 7 replies
  • 1161 views
  • 0 likes
  • 2 in conversation