BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lstockman
Fluorite | Level 6

Hello,

 

I'd like to add a caption under the table that results from this statement. A footnote is too far down the page. Thanks for any suggestions!

 

ODS PDF file="&savepathrep.\Table_1994_2017_&val._&filedate..pdf" 
STYLE=styles.analysis;

proc tabulate data=have missing classdata=dummy.dummyyr;
where lhj="&val";
class count vitalstat year;
table year*f=comma8.0 all*f=comma8.0, count*f=comma8.0 vitalstat*f=comma8.0 /misstext='0' printmiss box="&val";
label 	year='Year of Report'
		count='Confirmed Cases'
		vitalstat='Vital Status';
keylabel all='Total 1994-2017'; 
Title 'Title of Table Here';
run;

ODS PDF close;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I think that you want to use the Style=[Posttext=''] in the table options

 

proc tabulate data=have missing classdata=dummy.dummyyr;
where lhj="&val";
class count vitalstat year;
table year*f=comma8.0 all*f=comma8.0, 
      count*f=comma8.0 vitalstat*f=comma8.0 
      /misstext='0' printmiss box="&val"
       style=[Posttext='Title of Table Here']
;
label 	year='Year of Report'
		count='Confirmed Cases'
		vitalstat='Vital Status';
keylabel all='Total 1994-2017'; 
run;

Each table in Proc Tabulate can have both PRETEXT and POSTTEXT. I find the PRETEXT handy to place "titles" immediately above a table when generating multiple tables. The weakness is that I haven't been able, yet, to have as much appearance control as a TITLE statement offers.

 

View solution in original post

5 REPLIES 5
ballardw
Super User

I think that you want to use the Style=[Posttext=''] in the table options

 

proc tabulate data=have missing classdata=dummy.dummyyr;
where lhj="&val";
class count vitalstat year;
table year*f=comma8.0 all*f=comma8.0, 
      count*f=comma8.0 vitalstat*f=comma8.0 
      /misstext='0' printmiss box="&val"
       style=[Posttext='Title of Table Here']
;
label 	year='Year of Report'
		count='Confirmed Cases'
		vitalstat='Vital Status';
keylabel all='Total 1994-2017'; 
run;

Each table in Proc Tabulate can have both PRETEXT and POSTTEXT. I find the PRETEXT handy to place "titles" immediately above a table when generating multiple tables. The weakness is that I haven't been able, yet, to have as much appearance control as a TITLE statement offers.

 

lstockman
Fluorite | Level 6
Thanks! That works.
Cynthia_sas
SAS Super FREQ

Hi:
You could try ODS PDF TEXT but you'll also have to use STARTPAGE=NO option in your ODS PDF statement. or you could switch to PROC REPORT and do a COMPUTE block.

With ODS TEXT, you have to apply style overrides to alter the formatting.

ODS_PDF_Caption.png


I wouldn't use the ANALYSIS style because the background of the whole page is sort of creamy off-white color -- but that's a color preference. Otherwise, something like the above example should work. Since you didn't provide any data, I just used SASHELP.CLASS.


Cynthia

lstockman
Fluorite | Level 6
Thanks! This works too but for some reason the table appears twice before it adds the caption at the bottom. I'll look into it a bit.
lstockman
Fluorite | Level 6
fixed it - great solution, thanks.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1613 views
  • 1 like
  • 3 in conversation