BookmarkSubscribeRSS Feed
sks
Fluorite | Level 6 sks
Fluorite | Level 6
Hello,
I am using columns=2 in one of the pdf reports, since I am only printing 4 columns in the report. The stored process has 2 proc reports one for each type of rfmethod. Here is part of my code... For some reason with ods pdf columns=2, even though there is no data to display in the second proc report I still see the title that I want to display only when there is data for the second proc report. Any idea why the titles are printed even though there is no data for the proc.


/*TITLE for Paper Check Section*/
title5 "~S={font_style=roman font_weight=bold just=left font_size=10pt color=red}*~S={font_style=roman color=black font_weight=bold
just=left font_size=10pt}Payment Date: &Display_DATE  
~S={font_style=roman color=red font_weight=bold just=left font_size=10pt}*~S={font_style=roman font_weight=bold just=left font_size=10pt
color=black}Refund Method: &RFMETHOD ~S={font_style=roman font_weight=bold just=left font_size=10pt color=black}
Budget Code: &Budget_code_C ~n";
title6 "~S={font_weight=bold just=left font_size=11pt}~{Super ___________________________________________________________________________________________________
_________________________________________________________________________}";
title7 "~S={font_style=roman font_weight=bold just=center font_size=12pt}Paper Check Detail Section";
/*Specify number of columns
ods pdf ;
ods pdf
ODS PDF ;*/
ods pdf columns=2;
ods proclabel="Paper Check Details Section";
/*PROC REPORT for Paper Check Detail Section*/
PROC Report DATA=Work.REFUND_REGISTER_FILTER_T SPLIT='*' nofs nowd
Contents=""
style(report) =[background=white bordercolor=white borderwidth=0 asis=off just=center font_face='Times']
style(Header) =[background=white bordercolor=white borderwidth=0 asis=off just=left]
STYLE(SUMMARY) = {bordertopwidth=1PX bordertopstyle=solid bordertopcolor=black
borderbottomwidth=0px borderleftwidth=0 borderrightwidth=0};

WHERE RFMETHOD='Paper Check';

Column NCDORID BUDGET_CODE PAYMENT_NUM PAID_AMT RFMETHOD;

Define NCDORID / display width=9
style(column)=[font_size=11pt font_style=roman just=left]
style(Header) =[ font_size=11pt font_face='Times' font_weight=bold just=left];
Define BUDGET_CODE / display "Budget Code" width=25
style(column)=[font_size=11pt font_style=roman just=left]
style(Header) =[ font_size=11pt font_face='Times' font_weight=bold just=left];
Define PAYMENT_NUM / display "Payment Number" width=10
style(column)=[font_size=11pt font_style=roman just=left]
style(Header) =[ font_size=11pt font_face='Times' font_weight=bold just=left];
Define PAID_AMT / analysis sum display "Refund Amount" format=dollar12.2 width=15
style(column)=[font_size=11pt font_style=roman just=right]
style(Header) =[ font_size=11pt font_face='Times' font_weight=bold just=right];
Define RFMETHOD / display;
/*compute before _page_;
line "~S={font_style=roman font_weight=bold just=center font_size=12pt}Paper Check Detail Section";
endcomp;
*/
RUN;
ods pdf startpage=now;
/*TITLE for Direct Deposit Section*/
title5 "~S={font_style=roman font_weight=bold just=left font_size=10pt color=red}*~S={font_style=roman color=black font_weight=bold
just=left font_size=10pt}Payment Date: &Display_DATE  
~S={font_style=roman color=red font_weight=bold just=left font_size=10pt}*~S={font_style=roman font_weight=bold just=left font_size=10pt
color=black}Refund Method: &RFMETHOD ~S={font_style=roman font_weight=bold just=left font_size=10pt color=black}
Budget Code: &Budget_code_C ~n";
title6 "~S={font_weight=bold just=left font_size=11pt}~{Super ___________________________________________________________________________________________________
_________________________________________________________________________}";

TITLE7 "~S={font_style=roman font_weight=bold just=center font_size=12pt}Direct Deposit Detail Section";

/*specify number of columns*/
ODS PDF columns=2;
ods proclabel="Direct Deposit Details Section";
/*PROC REPORT for Direct Deposit Detail Section*/
PROC Report DATA=Work.REFUND_REGISTER_FILTER_T SPLIT='*' nofs nowd
contents=""
style(report) =[background=white bordercolor=white borderwidth=0 asis=off just=center font_face='Times']
style(Header) =[background=white bordercolor=white borderwidth=0 asis=off just=left]
STYLE(SUMMARY) = {bordertopwidth=1PX bordertopstyle=solid bordertopcolor=black
borderbottomwidth=0px borderleftwidth=0 borderrightwidth=0};

WHERE RFMETHOD='Direct Deposit';

Column NCDORID BUDGET_CODE PAYMENT_NUM PAID_AMT RFMETHOD;

Define NCDORID / display width=9
style(column)=[font_size=11pt font_style=roman just=left]
style(Header) =[ font_size=11pt font_face='Times' font_weight=bold just=left];
Define BUDGET_CODE / display "Budget Code" width=25
style(column)=[font_size=11pt font_style=roman just=left]
style(Header) =[ font_size=11pt font_face='Times' font_weight=bold just=left];
Define PAYMENT_NUM / display "Payment Number" width=10
style(column)=[font_size=11pt font_style=roman just=left]
style(Header) =[ font_size=11pt font_face='Times' font_weight=bold just=left];
Define PAID_AMT / analysis sum display "Refund Amount" format=dollar12.2 width=15
style(column)=[font_size=11pt font_style=roman just=right]
style(Header) =[ font_size=11pt font_face='Times' font_weight=bold just=right];
Define RFMETHOD / noprint;


Has anyone faced this issue, I would greatly appreciate if anyone can provide any insight on ods columns = statement and its 'side effects' on the title statement.

Thanks
SKS
6 REPLIES 6
ArtC
Rhodochrosite | Level 12
Two things:
1) you may want to check to see if any observations meet the WHERE criteria before issue the second REPORT step. This way you will not get the blank page.
2) if the TITLE statement(s) for the second report step appear before the ods pdf startpage=now is the situation improved?
sks
Fluorite | Level 6 sks
Fluorite | Level 6
> Two things:
> 1) you may want to check to see if any observations
> meet the WHERE criteria before issue the second
> REPORT step. This way you will not get the blank
> page.
> 2) if the TITLE statement(s) for the second report
> step appear before the ods pdf startpage=now is the
> situation improved?


Art,
There are no observations that meet the where criteria in the second report(that is what threw us off the curve infact even if there is no observation for the proc report, I get the title of the first proc report and the data of the second proc report which has the observations. If you would like to take a look I can send you the log file if you give me your email address).
Does not make any difference where the title statement is.

I am telling you the more I use ODS and proc report the more work arounds I have to find to get something the way the client wants it.............

SKS
Cynthia_sas
SAS Super FREQ
Hi:
The underlying assumption of almost all SAS procedures is that there -will- be data for the procedure to act on. If you think there will NOT be data for a particular report or step, generally, you use macro coding techniques to write out an alternate file or message or adjust the code that will be sent to the compiler.

So, asking the procedure to work the way you expect when there is no data for the second report seems unfair to PROC REPORT -- since its only purpose in life is to create reports from data -- not to internally adjust itself when there is no data.

I am curious -- if there IS data for the second report, do your titles come out the way you expect???? If the answer is yes, then you will probably need to find an alternate version of the code that gives you what you want in the 'no' data situation. If the STARTPAGE=NOW and titles do not come out correctly even WHERE there is data for the second report, then it seems to me that you have an issue for Tech Support. They could look at ALL your data and ALL your code and help you determine what the issue is. Also, I do seem to remember that STARTPAGE was worked on between SAS 8 and SAS 9 -- so there may be some version issues that are involved, too (which is another thing -- Tech Support can test your code in earlier versions of SAS -- other than SAS 9.2).

cynthia
Cynthia_sas
SAS Super FREQ
...I meant to say this, as well. You asked:

Any idea why the titles are printed even though there is no data for the proc.


Another factor is that "page" processing -- the whole process of issuing a "page break" (or not) and writing titles is somewhat independent of a procedure's action on the data. SAS sees a procedure step -- SAS starts an output file based on the ODS statements. The first thing that normally happens is the title processing and page numbering, etc happens at the top of the first page. Then, SAS sees a step boundary; and let's say that there is another procedure. At that point, where SAS sees the step boundary and another procedure, it does 2 things:
1) issues a "page eject" and performs title, date and number placement, based on options, etc.
2) starts the next procedure

Sometimes, the output is written one line at a time to the output file (such as with LISTING); and then, sometimes as with PostScript or PDF, an "image" of each page is built internally in a buffer area and then is written to the ODS output file.

At the point in time when the procedure has started, page processing has already "handled" the titles. This process could be impacted by STARTPAGE -- but the part that would be impacted would be issuing the page break. That's another reason to work with Tech Support.

And, since you're doing all this in a stored process (with the Stored Process Web App? with EG? with the Information Delivery Portal?) that will make the testing a bit more complicated -- although if you can get the page breaks and titles the way you want in Base SAS, the stored process output should not be different (although you may have to be explicit about all the options that need to be in effect for your stored process to execute.

cynthia
sks
Fluorite | Level 6 sks
Fluorite | Level 6
Cynthia,
Thank you very much for the detailed response. Just to let you know the stored process is being developed in EG and will be executed thru the portal. When there is observations for both proc reprots the report prints perfectly fine the titles and the data are exactly the way it should be. The problem is occuring only when one or the other condition is true. we have tried a few things here and have come to the conclusion that using the ods pdf columns=2 in the reports is the culprit because if we comment the ods pdf columns line in our entire code the report works perfectly fine (if there is no observations for a particular proc report the data and the titles are not printed) but the downside is that a lot of real estate is being wasted (the report only displays 4 columns on a landscape sheet)

SKS
Cynthia_sas
SAS Super FREQ
I think in the long run that ODS LAYOUT will probably prove to be more robust for what you want instead of just using COLUMNS=2, but ODS LAYOUT is pre-production right now.

If you went ahead and opened a track on this with Tech Support, then the issue would have some visibility through Tech Support channels and might eventually get to the developers.

For an example of the type of thing that ODS LAYOUT will be able to do, have a look at this paper (which also talks about using COLUMNS= with ODS PDF).
http://www.wuss.org/proceedings09/09WUSSProceedings/papers/dpr/DPR-OConnor.pdf

cynthia

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!

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
  • 6 replies
  • 1506 views
  • 0 likes
  • 3 in conversation