Data visualization with SAS programming

Proc Tabulate and ods pdf.: Table Columns Generate on Separate Pages

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 142
Accepted Solution

Proc Tabulate and ods pdf.: Table Columns Generate on Separate Pages

Hi there--

When I run the proc tabulate tables below in pdf format each column in the tabulate table generates on a different page on a separate page. The html version seems to generate correctly.    I’ve can’t see what the ods pdf issue is. Below is the program and I’ve attached the pdf output.

ods listing;

options leftmargin="1 in" topmargin="1 in"

        rightmargin="1 in" bottommargin="1 in"

        nodate nonumber orientation=portrait;

ods pdf file='Z:\SAS\SASCODE\test.pdf';

ods html file='Z:\SAS\SASCODE\test.html';

ods escapechar='^';

options nodate nonumber pageno=1;

ods pdf startpage=no; run;

proc tabulate data=med.All_Med_QsF

(where=(question in('Q4','Q5B')))

style=[background=white foreground=black  font_face='Arial Narrow' font_size=10.5pt just=c];

class Question REVIEW_S

/ style={font_face='Arial Narrow' font_weight=bold font_size=11pt cellheight=50 };

class Responce1 / order=formatted

style={font_face='Arial Narrow' font_weight=bold font_size=11pt};

classlev question

/style=[font_face='Arial Narrow' font_size=11pt];

classlev  REVIEW_S

/style={font_face='Arial Narrow' font_size=10pt cellwidth=.6in cellheight=.4in just=l};

classlev

Responce1

/style={font_face='Arial Narrow' font_size=11pt  };

table Question=' ',

REVIEW_S  =' '

all='Overall Agency Totals',

Responce1=' '*(n='Count'*f=best8. pctn='%'*f=p.)

n='Count Total' pctn='% Total' *f=p.

/style={font_face='Arial Narrow' font_size=11pt cellwidth=.6in }

row=float 

box={label='Count^{newline 1}Overall^_%'

style={font_face='Arial Narrow' font_size=10pt font_weight=bold cellwidth=.6in}};

format question $medQs.;

format responce1 medresponse.;

keyword n pctn  /

style=[font_weight=bold foreground=black  font_face='Arial Narrow' font_size=10pt just=c];

keyword all/ style=[font_weight=bold foreground=black  font_face='Arial Narrow' font_size=10pt just=l];

run;

ods _all_ close;

ods listing;


Accepted Solutions
Solution
‎04-29-2012 06:24 PM
SAS Super FREQ
Posts: 8,646

Re: Proc Tabulate and ods pdf.: Table Columns Generate on Separate Pages

Hi:

  My recommendation would be to remove ALL cellheight and cellwidth specifications (yes, ALL of them) from your entire step. Then gradually, put them back in one at a time, seriously, one at a time, until you find the one that "breaks" PDF. I don't actually think you need to fiddle with cellheight at all. My experience is that ODS PDF adjusts the height usually OK if I don't specify anything. If you are going to specify units of measure such as IN, then use the same units for all dimensions. If you don't have any unit of measure, you get pixels, which must be converted. The thing is that you can try to "overcontrol" PDF to the point where it decides that you are asking for the impossible. Generally, if you specify something like outputwidth=100% on the TABLE statement style override, then PDF will figure out how many cells it needs per page and will divide them accordingly.

  HTML output can be as wide as it needs to be. I doubt that you will be able to find cellwidths that will work for both HTML (doesn't care how wide it is) and PDF (does care how wide it is because it is bound by margin sizes).

  If simplifying the style overrides doesn't work and you can't find the breaking point, then you may want to work with Tech Support on this question.

cynthia

ps...do you also have SAS/GRAPH or ODS GRAPHICS in the step??? I just wondered because of posting the TABULATE question in the Graph forum.

View solution in original post


All Replies
Solution
‎04-29-2012 06:24 PM
SAS Super FREQ
Posts: 8,646

Re: Proc Tabulate and ods pdf.: Table Columns Generate on Separate Pages

Hi:

  My recommendation would be to remove ALL cellheight and cellwidth specifications (yes, ALL of them) from your entire step. Then gradually, put them back in one at a time, seriously, one at a time, until you find the one that "breaks" PDF. I don't actually think you need to fiddle with cellheight at all. My experience is that ODS PDF adjusts the height usually OK if I don't specify anything. If you are going to specify units of measure such as IN, then use the same units for all dimensions. If you don't have any unit of measure, you get pixels, which must be converted. The thing is that you can try to "overcontrol" PDF to the point where it decides that you are asking for the impossible. Generally, if you specify something like outputwidth=100% on the TABLE statement style override, then PDF will figure out how many cells it needs per page and will divide them accordingly.

  HTML output can be as wide as it needs to be. I doubt that you will be able to find cellwidths that will work for both HTML (doesn't care how wide it is) and PDF (does care how wide it is because it is bound by margin sizes).

  If simplifying the style overrides doesn't work and you can't find the breaking point, then you may want to work with Tech Support on this question.

cynthia

ps...do you also have SAS/GRAPH or ODS GRAPHICS in the step??? I just wondered because of posting the TABULATE question in the Graph forum.

Frequent Contributor
Posts: 142

Re: Proc Tabulate and ods pdf.: Table Columns Generate on Separate Pages

Hi Cythia--

As always you are totally correct and very helpful. Thanks!

Post a Question
Discussion Stats
  • 2 replies
  • 373 views
  • 0 likes
  • 2 in conversation