BookmarkSubscribeRSS Feed
FrankE
Fluorite | Level 6
Hi guys, I'm having some trouble...

I'm outputting a pdf via ods and I want to put an image justified left in the header with text centered to the right like this:

|-----------------|
|-----------------| This is the title1
|-----------------| This is title2
|-----------------|
|-----------------|

any help would be appreciated!

Message was edited by: FrankE

Message was edited by: FrankE

Message was edited by: FrankE

Message was edited by: FrankE
5 REPLIES 5
Cynthia_sas
SAS Super FREQ
Hi:
Try this (without an image):
[pre]
title1 j=c 'Centered Title';
title2 j=l 'Left' j=c 'Another Thing';
title3 j=l color=red 'Left' j=c h=16pt 'Center' j=r c=green 'Right';
[/pre]

The justification attribute can be used on a TITLE statement to alter the justification of separate text strings. In addition, you can specify multiple strings and multiple justifications....and multiple colors and sizes. The attribute that you are changing must precede the string that you want to impact.

For an example of using an image in a TITLE statement, see this previous forum posting:
http://support.sas.com/forums/thread.jspa?messageID=5882᛺

cynthia
FrankE
Fluorite | Level 6
Thanks for your help.

The issue I'm having is getting the text to center vertically and horizontally with the image...

I have:

title1 j=l '^S={preimage="D:\Images\ABA_blue_trans.jpg"} ' j=c 'Test Text';
title2 j=c 'Line2';

"Test Text" is in line vertically with the bottom of the image and "Line 2" is below the image. How do I get the text to center vertically with the image?
FrankE
Fluorite | Level 6
Here's a paper I found where the examples are exactly what I want. Logo on the left, text to the right centerd vert and horiz with the image... however the code snippits don't produce the same result for me 😞

http://www2.sas.com/proceedings/sugi29/157-29.pdf
Cynthia_sas
SAS Super FREQ
Hi:
Example 1 uses RTF and a custom style template designed specifically for RTF and the description implies that the template contains RTF specific instructions ... so, I wouldn't expect the RTF example to work for PDF or HTML output.

Example 2 uses ODS PDF and ODS LAYOUT. ODS LAYOUT is experimental or "pre-production" and depending on what version of SAS you have, may or may not work for you as it did in her example.

When I use code, such as what's shown below, however, I -do- see the center text strings middle justified in the space taken up by the image of Kermit. The Escapechar+S (~S in my code) is specifying a vertical justification of Middle for the text strings that follow it and the Escapechar+N (in this case ~n) represents a line feed or carriage return every time it appears in a text string. Note that the escapechar that I declare in the ODS ESCAPECHAR statement must be the same as the ESCAPECHAR I use in my text string.

The only other reason I can think of for you to have issues is if you are trying to use an image along with the Page X of Y page numbering. In some instances, I think those 2 combos can give you problems.

cynthia
[pre]
ods pdf file='c:\temp\logo_labelx.pdf';
ods escapechar='~';
title j=l '~S={preimage="c:\temp\kermit.gif"}'
j=c '~S={vjust=m} 1) Title line 1~n Another Line~n A third line';

proc report data=sashelp.shoes(obs=6)nowd;
column region product sales;
define region / 'Region';
run;

ods pdf close;
[/pre]
FrankE
Fluorite | Level 6
And that worked perfectly! Thanks so much! I've been beating my head against this all day! So funny how I spent hours and the solution is literally 2 lines long. lol. Thanks again!

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
  • 5 replies
  • 4391 views
  • 2 likes
  • 2 in conversation