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
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...
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 = ...."
Hi collinelliot,
Removing the previous data set helped for couple of month until I got some results in one month, but when I hit 0 results again it defaulted to old one again...
I also tried ODS noresults in the beginning of the code and ODS results at the end - Also doesn't seem to help...
So, I am very perplexed on how to make it consistent with results, because when I let my manager to run the code he doesn't know how to distinguish between old and new results in PDFs... I added the time stamp for now, but I am sure the must be solution for this...
Does anyone know if I should contact maybe SAS support team for this? I would assume it must be a glitch in the system...
Thanks Everyone!
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.
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;
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?
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...
Great. Good luck.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: