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

Hi,

 

When I create PDF output title is starting from .5 in left and body is starting from 1.25in. I am bit confused what statement should be chnaged in proc template to start both from same.

 

I attached here the file which I am facing issue.

 

my code:

 

proc template;
define style std/store=templates;
parent = Styles.rtf ;
class fonts /
'TitleFont' = ("Courier, Times Roman, Times", 8pt )
'TitleFont2' = ("Courier, Times Roman, Times", 8pt )
'footFont' = ("Courier, Times Roman, Times", 8pt )
'StrongFont' = ("Courier, Times Roman, Times", 8pt)
'EmphasisFont' = ("Courier, Times Roman, Times", 8pt,Italic)
'headingEmphasisFont' = ("Courier, Times Roman, Times", 8pt)
'headingFont' = ("Courier, Times Roman, Times", 8pt)
'docFont' = ("Courier, Times Roman, Times",8pt)
'FixedEmphasisFont' = ("Courier, Times Roman, Times", 8pt)
'FixedStrongFont' = ("Courier, Times Roman, Times", 8pt)
'FixedHeadingFont' = ("Courier, Times Roman, Times", 8pt)
'BatchFixedFont' = ("Courier, Times Roman, Times", 8pt)
'FixedFont' = ("Courier, Times Roman, Times", 8pt) ;

class color_list / 'link'= blue 'bgH' = white 'bgT' = white 'bgD' = white 'fg' = black 'bg' = white ;

style Table from Output / cellpadding=2pt cellspacing=0.25pt just=center rules = groups frame= above ;

replace headersandFooters from cell/ font = fonts('HeadingFont') foreground = blank background = white;

class systemtitle / protectspecialchars=OFF asis=ON ;
class systemfooter / font=Fonts('footFont') protectspecialchars=OFF asis=ON ;
class text / 'continued' = " " ;
class continued / pretext=text('continued') width=_undef_ frame=void rules=none cellpadding = .6pt cellspacing = 0 ;
class header / protectspecialchars=off ;
class data / protectspecialchars=off ;
class rowheader / protectspecialchars=off ;
class usertext / protectspecialchars=off ;
class byline / protectspecialchars=off ;
/* style header from headersandfooters / protectspecialchars=OFF just=center cellpadding=0 cellspacing=0 font_weight=bold; */ *controlling Column Names*;
style table from output / just=center frame=above rules=groups background=color_list('bgT');
style data from cell / outputwidth=100% cellpadding=1 cellspacing=1 asis=on protectspecialchars=OFF nobreakspace=OFF asis=ON;
style body from document / leftmargin=0.5in rightmargin=0.5in topmargin=1.0in bottommargin=1.0in;
end;

quit;
%mend std_ods_style;
%std_ods_style;

 

.Report.JPEG

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  Without going into the world of templates, I can illustrate the opposite of what you're seeing, by stretching the table output to 100% -- which means it will take up all the space from margin to margin, as shown below (for RTF):

example_margins_table_title.png

 

By default, ODS will center the table output within the margins for paged destinations like RTF and PDF. So either you use NOCENTER to make the table flush left or you stretch the table using width=100%, as shown in my code below.

 

With short titles or long titles, they too will be centered in the margins. If you use J=L or J=R in the title, you can see where the margins are as I set them in the OPTIONS statement.

 

cynthia

 

Code below:


options topmargin=.5in bottommargin=.5in leftmargin=.5in rightmargin=.5in;
ods rtf file='c:\temp\stretch.rtf';

title1 j=l 'Left' j=c 'Center' j=r 'Right';
title2 'Short Title';
title3 'This is Really a Very, Very, Very, Very, Very, Very, Very (Really) Very Long Long Title';
proc report data=sashelp.class
     style(report)={width=100%};
run;

ods rtf close;

View solution in original post

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  Without going into the world of templates, I can illustrate the opposite of what you're seeing, by stretching the table output to 100% -- which means it will take up all the space from margin to margin, as shown below (for RTF):

example_margins_table_title.png

 

By default, ODS will center the table output within the margins for paged destinations like RTF and PDF. So either you use NOCENTER to make the table flush left or you stretch the table using width=100%, as shown in my code below.

 

With short titles or long titles, they too will be centered in the margins. If you use J=L or J=R in the title, you can see where the margins are as I set them in the OPTIONS statement.

 

cynthia

 

Code below:


options topmargin=.5in bottommargin=.5in leftmargin=.5in rightmargin=.5in;
ods rtf file='c:\temp\stretch.rtf';

title1 j=l 'Left' j=c 'Center' j=r 'Right';
title2 'Short Title';
title3 'This is Really a Very, Very, Very, Very, Very, Very, Very (Really) Very Long Long Title';
proc report data=sashelp.class
     style(report)={width=100%};
run;

ods rtf close;

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
  • 1 reply
  • 2551 views
  • 0 likes
  • 2 in conversation