BookmarkSubscribeRSS Feed
ihtarahb
Calcite | Level 5

Hello  ,

I am looking for a simple tweak in my style template , to mention title1-title4 as left justified and title5-title9 as center justified . I have got some 30 tables to report and I do not want to insert j=c in every table title4-9 . Please let me know if there is an easy way to achieve this multiple justification for all the tables in a report.  proc template; header ? or any function that checks title number ?

Thanks !

5 REPLIES 5
Reeza
Super User

What's your destination, HTML, PDF?

You could probably do it via a template or CSS Style sheet.

ballardw
Super User

See if this gives you a starting point.

proc template;
   define style Styles.myFontsize ;
   parent = Styles.default; /* or the one you prefer*/
    style SystemTitle from TitlesAndFooters /
      fontsize= 26pt;
   style SystemTitle2 from SystemTitle /
      fontsize= 24pt;
   style SystemTitle3 from SystemTitle2 /
      fontsize= 22pt;
   style SystemTitle4 from SystemTitle3 /
      just=center
      fontsize= 20pt;
   style SystemTitle5 from SystemTitle4 /
      fontsize= 18pt;
   style SystemTitle6 from SystemTitle5 /
      fontsize= 16pt;
   style SystemTitle7 from SystemTitle6 /
      fontsize= 14pt;
   style SystemTitle8 from SystemTitle7 /
      just=right
      fontsize= 12pt;
   style SystemTitle9 from SystemTitle8 /
      fontsize= 10pt;
   style SystemTitle10 from SystemTitle9 /
      fontsize= 8pt;
   style SystemFooter from TitlesAndFooters /
      fontsize= 26pt;
   style SystemFooter2 from SystemFooter /
      fontsize= 24pt;
   style SystemFooter3 from SystemFooter2 /
      just=center
      fontsize= 22pt;
   style SystemFooter4 from SystemFooter3 /
      fontsize= 20pt;
   style SystemFooter5 from SystemFooter4 /
      fontsize= 18pt;
   style SystemFooter6 from SystemFooter5 /
      fontsize= 16pt;
   style SystemFooter7 from SystemFooter6 /
      just=right
      fontsize= 14pt;
   style SystemFooter8 from SystemFooter7 /
      fontsize= 12pt;
   style SystemFooter9 from SystemFooter8 /
      fontsize= 10pt;
   style SystemFooter10 from SystemFooter9 /
      fontsize= 8pt;
  end;
run;

ods html style=Styles.myFontsize;

title1  'title1 ';
title2  'title2 ';
title3  'title3 ';
title4  'title4 ';
title5  'title5 ';
title6  'title6 ';
title7  'title7 ';
title8  'title8 ';
title9  'title9 ';
title10 'title10';

footnote1  'footnote1 ';
footnote2  'footnote2 ';
footnote3  'footnote3 ';
footnote4  'footnote4 ';
footnote5  'footnote5 ';
footnote6  'footnote6 ';
footnote7  'footnote7 ';
footnote8  'footnote8 ';
footnote9  'footnote9 ';
footnote10 'footnote10';

proc print data=sashelp.class (obs=1);run;

ihtarahb
Calcite | Level 5

Thanks a lot Ballard !  It worx Smiley Happy . Does title10  really work ? it has many times overwritten my title1 . 

Reeza ,  I was writing to a PDF.

Test Code :

proc template;

   define style Styles.testpatience ;

   parent = Styles.Mypdf;

   style systemTitle /

   just = left

   font_size = 5

   font_weight = bold

   font_style = italic

   ;

/* Until title5 the above attribs are applied */

   style SystemTitle5 from SystemTitle /

   just=center;

/*This Attrib is Applied to all the titles from title5 */

   style systemFooter /

   just = left

   font_size = 5

   ;

   end;

run;

ballardw
Super User

The example I provided, at least in HTML, shows Title10 text on my system.

I would look for a missing "0" (zero) on a title statement somewhere that you think is a title10 statement.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

As an alternative, you could set a dataset up to hold title/footnote and style information and generate from there:

SECTION             NO     JUST     TEXT          ... Could add style etc.

TITLE                    1         L            ABV

TITLE                    2         R           ERT

...

data _null_;

     call execute(cats(section," ",strip(put(no,best.))," j=",just," '",text,"';");

run;

    

If you have a lot of titles it nice to be able to store them, qc them, manage them in a dataset or Excel file and not need to type them out.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1019 views
  • 7 likes
  • 4 in conversation