BookmarkSubscribeRSS Feed
ScottBass
Rhodochrosite | Level 12

Hi,

This usage note http://support.sas.com/kb/41/703.html discusses wrapping footnote text containing a preimage.  However, the syntax is deprecated (according to a previous post in this forum by Cynthia).

1)  Perhaps this usage note could be updated with the currently recommended syntax???  Or at least provide both syntaxes?

2)  I've got this code, but the ^n isn't breaking the title line as desired.  Any ideas?

%let logo=Z:\Program Files\SAS\SASWebInfrastructurePlatform\9.2\Static\wars\sas.storedprocess\images\bluesas.gif;

options nodate nonumber;

options pagesize=A4;  /* 210 x 297 mm */

options orientation=landscape;

title;

footnote;

filename temp temp;

ods _all_ close;

ods escapechar="^";

ods pdf file=temp notoc;

/*

You need to left justify the title segment (j=l),

then adjust the cellwidth to suit the pagesize (cellwidth=285mm),

then use a style justification (just=c)

to center the title within the expanded cellwidth.

*/

title1

  j=l "^{style [just=c vjust=m fontsize=24pt cellwidth=285mm]This is a very long title ^n which I want to wrap over two lines}"

  j=r "^{style [preimage=""&logo""]}"

;

proc report nowd data=sashelp.cars;

run;

ods pdf close;

ods listing;

Thanks,

Scott


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi,

  The new "newline" syntax is escapechar{newline #} so if you have:

ods escapechar='^';

then

^{newline 1} is 1 line feed or return

^{newline 2} is 2 line feeds or returns, etc, etc. Where the # after newline is the number of line feeds or returns that you want.

  If still have issues, then you might consider opening a track with Tech Support for resolution, if their posted code does not work for you in a newer version of SAS.

cynthia

ScottBass
Rhodochrosite | Level 12

Hi Cynthia,

I'm sure the posted code would work, but it has this syntax:

footnote j=l "^S={preimage='c:\ods_code\cropped.jpg'}"
j=c "^S={just=l vjust=m cellwidth=5in}'Centered' footnote with a really really really long string of ^n
text which we can control relative to the image's height.^2n";

which I thought was deprecated?  Regardless, I didn't want to change my code syntax to match this (deprecated?) syntax.  Thus my suggestion to update the unote.

I've tried all of the below, and none of them give me my desired results:

title1

  j=l "^{style [just=c vjust=m fontsize=24pt cellwidth=285mm]This is a very long title ^{newline}which I want to wrap over two lines}"

  j=r "^{style [preimage=""&logo""]}"

;

title1

  j=l "^{style [just=c vjust=m fontsize=24pt cellwidth=285mm]This is a very long title ^{newline}"

      "^{style [just=c vjust=m fontsize=24pt cellwidth=285mm]which I want to wrap over two lines}"

  j=r "^{style [preimage=""&logo""]}"

;

title1

  j=l "^{style [just=c vjust=m fontsize=24pt cellwidth=285mm]This is a very long title ^{newline}"

  j=l "^{style [just=c vjust=m fontsize=24pt cellwidth=285mm]which I want to wrap over two lines}"

  j=r "^{style [preimage=""&logo""]}"

;

title1

  j=l "^{style [just=c vjust=m fontsize=24pt cellwidth=285mm]This is a very long title}"

  j=l "^{style [just=c vjust=m fontsize=24pt cellwidth=285mm]which I want to wrap over two lines}"

  j=r "^{style [preimage=""&logo""]}"

;

Here is what I want to do:

My PDF output (landscape orientation) is very full vertically.  I need to put the logo in the upper right corner on every page, but I need to center the titles on the page.  The titles (some of them long) where fine when I didn't have j= options in the title, which I believe are required for the right justified preimage.

The left justified, very wide cellwidth, with an "internal" style justification=center, is my attempt to workaround the limitation listed in the above usage note, which states:

"When using any of the SAS/GRAPH® justification options J=L, J=C, and J=R, SAS divides titles and footnotes into equal thirds on an ODS PRINTER (PCL/PDF/PS) page. Because this is an equal split, it is difficult to wrap text across the height of an image included with the PREIMAGE style attribute."

It's unfortunate I can't "merge" these equal thirds somehow.

If I don't specify the cellwidth, the center third of the page width is way too narrow for my titles, esp. given my point size, and they always wrap to a second line, which shoves content onto a second page of what needs to be a single page report.

However, with the cellwidth, some of my very long titles overwrite the logo.  These are the titles I need to wrap, with no extra spacing between the title lines.  Both lines of the title need to be the same point size and centered.

None of the above attempts accomplish this.

If I use a title2, I get too much space between the two titles, and again the content shifts to a 2nd page.  If there is a way I can reduce the spacing between title lines, that could be the best solution.  Whatever the solution, I need to minimize the space consumed by the titles and preimage logo. 

(I've already reduced the data font-size as far as I want to go.  I also checked the margins via proc options group=odsprint; they are all 0.000in).

Thanks for any additional ideas you can provide.

Regards,

Scott


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
Cynthia_sas
SAS Super FREQ

Hi:

  Hmmm, I thought {newline} needed a number. Did you try ^{newline 1} instead of just ^{newline}?

  I believe that you can change the amount of white space around the title. Each title is surrounded by a TITLE "container" -- so I think you may need to change the cellpadding of the "container" and you can probably only do that in a style template.

  One other solution is to make an image that contains the logo and the text and then your title statement would be for the entire picture of the text and the logo.

  Whether to use ^n versus ^{newline 1} is up to you. The original syntax should still work. Some parts of the original syntax will probably stop working but much of the original syntax will still work (it was my understanding that things like ^w and ^m would be what stopped working -- wrapping and marking were always dicey in the original syntax and I am not heartbroken that they will definitely not be moving forward}. But there are some instances, where you have existing code that used ^n and ^S= and you don't want to immediately or can't move them to the newer syntax. If ^n works but ^{newline 1} doesn't then that is something to report to Tech Support so they CAN amend that Tech Support note or alert the developers. It may be that ^n and ^{newline 1} have slightly different internal workings -- so if it comes down to understanding the internal workings in a particular situation, that is a question for Tech Support. In all my programs, I have found ^n and ^{newline 1} to be equivalent.

  The reason for using the newer syntax is that the newer, more "function-like" syntax is cool and more uniform and regular in usage and therefore easier to explain. It allows nesting of style specifications, something that wasn't possible in the original syntax. The new {unicode ####} escapechar function is totally handy and better than the old way of inserting characters. But, as far as I know, the original syntax is just there, you can still use it; it's only documented in a few user group papers and it'll never be enhanced, but it's still "there". Normally, I try things with the new syntax. If I'm not sure what version of SAS someone is running, then I might use the original syntax, just to provide the most flexible code. If there's something that doesn't work with the original syntax and it does work with the newer syntax, I usually provide an alternative example. On the other hand, if there's something that DOES work with the original syntax and does NOT work with the new syntax, I generally report that to Tech Support.

  Tech Support can help you with your logo issues and if you need a style template then they could help you with that, too.

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 2999 views
  • 0 likes
  • 2 in conversation