The SAS Output Delivery System and reporting techniques

PDF output issue

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

PDF output issue

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


Accepted Solutions
Solution
‎03-28-2017 10:53 AM
New Contributor
Posts: 4

Re: PDF output issue

Posted in reply to collinelliot

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


All Replies
PROC Star
Posts: 307

Re: PDF output issue

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 = ...."

New Contributor
Posts: 4

Re: PDF output issue

Posted in reply to collinelliot

Hi collinelliot,

 

 

 

PROC Star
Posts: 307

Re: PDF output issue

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. 

New Contributor
Posts: 4

Re: PDF output issue

Posted in reply to collinelliot

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;

 

 

PROC Star
Posts: 307

Re: PDF output issue

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?

Solution
‎03-28-2017 10:53 AM
New Contributor
Posts: 4

Re: PDF output issue

Posted in reply to collinelliot

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...

PROC Star
Posts: 307

Re: PDF output issue

Great. Good luck.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 253 views
  • 0 likes
  • 2 in conversation