The SAS Output Delivery System and reporting techniques

Styling Titles in Proc Report ods pdf

Reply
Occasional Contributor
Posts: 10

Styling Titles in Proc Report ods pdf

Hi,

I'm trying to organize titles in my report (title1 is the same for each page, title2 is different) see attachment.

I use ods pdf text, because I couldn’t do it with titles properly. I've got every time different result.

I think if I run the same syntax again and again, without closing the SAS program, I have to reset the options back to the original state first. I do not know how to do that and if this will be helpful to resolve the problem with my titles.

Any help is really welcome

Thanks

Attachment
SAS Super FREQ
Posts: 8,820

Re: Styling Titles in Proc Report ods pdf

Hi:

I'm not sure what your original code with ODS PDF TEXT= is really doing. But given that you are changing orientation between one PROC REPORT and another, I think you can do everything  you want to do with TITLE statements. I didn't see that you really needed STARTPAGE=NOW, either. This code below produced the attached screenshot. ODS TEXT= and ODS ESCAPECHAR are also ways to specify text strings and alter the style of text strings, but the TITLE statement has support, right on the TITLE statement, without ODS ESCAPECHAR, to alter font, bold, italic, justification, and size (height). The ODS TEXT can get tied up with STARTPAGE and end up under one table instead of at the start of a page. But I have always found the TITLE statement to be quite reliable (as long as I don't use STARTPAGE=NO).

Before I move into ODS PDF TEXT= and STARTPAGE, I try to exhaust what can be done with the regular TITLE statement. If your goal is to change the titles between procedures, this is the way I would do it. If you must have an ODS PDF TEXT= solution, then I would suggest that you open a track with Tech Support.

cynthia

ods escapechar='^';

options missing='0' orientation=portrait nodate;

ods listing close;

ods pdf file="c:\temp\29416_use_title_only.pdf." notoc;

proc report data=sashelp.class nowd spanrows;

title f='Times' bold italic j=c h=18pt 'Test: ME feedback per lezer 2012';

title2 j=c f='Times' bold italic h=18pt "ME feedback per lezer 2012";

title3 '^{newline 1}'; /* one extra line */

title4 j=c f='Times' bold italic h=18pt "Technische heroproep  2012";

title5 '^{newline 2}'; /* insert extra spaces */

title6 j=l f='Times' bold h=14pt italic "Tabel 1. Technische heroproep per eerste lezer";

column ('Mammografische/eenheid' sex name age height weight);

define sex / order;

run;

        

options orientation=landscape nodate nolabel;

ods pdf;

run;

    

proc report data=sashelp.shoes(obs=10) nowd;

title f='Times' bold italic j=c h=18pt 'Test: ME feedback per lezer 2012';

title2 j=c f='Times' bold italic h=18pt "ME feedback per lezer 2012";

title3 '^{newline 1}';

title4 j=c f="Times" bold italic h=18pt "Radiografische kwaliteit 2012";

title5 '^{newline 2}';

title6 j=l f="Times" bold italic h=14pt "Tabel 2. Radiografische kwaliteit per eerste lezer";

column ('Mammografische/eenheid' region subsidiary product sales  returns inventory);

define region / order;

run;

ods pdf close;

title;

Occasional Contributor
Posts: 10

Re: Styling Titles in Proc Report ods pdf

Dear Cynthia,

Thanks for your help.

When I use the same structure like in your code I get good result (result1.pdf). When I insert some text with ods pdf text before the table I get another result (result2).

It seems that  I can’t combine title and ods pdf text in the same ods pdf file. Is that correct?
Do I need then insert all my text with title?

Best regards,

Svetlana

Attachment
Attachment
SAS Super FREQ
Posts: 8,820

Re: Styling Titles in Proc Report ods pdf

Hi:

  I cannot answer that question (about combining titles and ods text=). There have been times that I have done it and it works fine. There are times that it worked oddly, but most of the times when it has worked oddly for me involved using a mixture of STARTPAGE=NO with STARTPAGE=NOW.

  If you are encountering an issue, such as you describe, the best resource for you is to open a track with Tech Support. If they verify that you are using TITLES and ODS TEXT= correctly and they observe the same issue, then they have the method by which to alert the developer and report this as a possible bug that needs to be fixed.

  Any other comments about whether it -should- work is only speculation. I have had ODS PDF TEXT= work. I have seen it not work. Most of the times it has not worked, I have been able to workaround or take another approach. I don't see where you really need ODS PDF TEXT= in your example. And I'm not in a position to run code today due to other committments. There are some things in your code that probably don't work anymore with ODS PDF, like -2n as a way to wrap text, that was possible in the first iteration of ODS ESCAPECHAR, but when the new syntax for ODS ESCAPECHAR came out in SAS 9.2, some of former syntax for marking and wrapping lines was not carried forward as a supported feature, so I tend to avoid things like escapechar+m or escapechar+w or escapechar+-2n. I really think this is a question for Tech Support if you really need to make ODS PDF TEXT= work.

cynthia

Ask a Question
Discussion stats
  • 3 replies
  • 462 views
  • 3 likes
  • 2 in conversation