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

 

When trying to format text to display in colors where I need a superscript, the superscript is always displaying low on the text line.

Often, depending on the color, the superscript also reverts to black as well and impacts the text color for following lines if the foreground color is not declared again.

 

I am working with SAS 9.4M5.

I am creating presentation charts in ODS PDF with titles on each page.  

One of the titles required by my users is to insert a quote that they want linked to a citation later in the presentation.  

They have decided to use a superscript.

 

The below code demonstrates the issue in Windows 10 and Base SAS and also Adobe Acrobat Reader DC.

 

I can't consistently get superscripts to work correctly.

If I just use the syntax ^{super 1}  I can get a superscript in black only but it does superscript.

However, if I want to add a style for the superscript using this syntax "^{super^{style[foreground=green]}1}"  the superscript number is printed but no longer raised and not in the format that was requested.  The superscript always wants to print in black.  

This is unfortunate because I am placing white text on a black background per user requirements.  

My example below is using red and white just to make it easier to see the issue.

 

 

ods pdf file='c:\data\temp.pdf';
ods escapechar='^';

data slide2;
length slide2text $ 2000.;
slide2text=catx(" ","^S={font_weight=medium foreground=black background=red font_size=28pt}This is a sample title black on red ",
"^S={font_weight=medium foreground=white background=red font_size=12pt}^n here is a quote that needs a superscript notation." ,
"^{super^{style[foreground=green]}1}",
"^nthis value is superscripted with style formatting ^{super^{style[background=white foreground=red]} 1} ",
"^n this value is superscripted without formatting ^{super 1} ",
" ");

/* ^{style[foreground=white]}*/
run;

proc print data=slide2;
title '^nthis value is superscripted ^{super^{style[foreground=red]} 1} ';
title2 '^nthis value is subscripted ^{sub 2} ';
title3 '^nthis value is superscripted ^{super 1} ';
/* title;*/
/* title2;*/
run;

ods pdf close;

This renders correctly in my Results window   as one large black line, and three white lines following with superscirpts, but when I open the PDF file in Adober that was  created by SAS ,the superscript with style formatting always goes to black and also sets the text color to black on all subsequent lines.  

I have been able to keep the color for the superscript in some examples but the location still is low on the line.

 

Am I missing any commands or options that would help with this?

 

Thanks,


Carl Richardson

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  I found it hard to see the colors with red backgrounds, so  I simplified your code and made the background white so I could really focus on the superscripts on the "slide" text.

 

  I also simplified the data so instead of a line feed at the beginning of each line, I just made 1 obs per line.

 

  Instead of PROC PRINT I used PROC REPORT with NOHEADER so I could just see the rows without any header. This is what I came up with:

 

super_sub_PDF.png

Not exactly what you showed, but I think putting the style override around the super function (instead of putting super around the style) seems to make the sizing all uniform in my output.

 

Cynthia

View solution in original post

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  I found it hard to see the colors with red backgrounds, so  I simplified your code and made the background white so I could really focus on the superscripts on the "slide" text.

 

  I also simplified the data so instead of a line feed at the beginning of each line, I just made 1 obs per line.

 

  Instead of PROC PRINT I used PROC REPORT with NOHEADER so I could just see the rows without any header. This is what I came up with:

 

super_sub_PDF.png

Not exactly what you showed, but I think putting the style override around the super function (instead of putting super around the style) seems to make the sizing all uniform in my output.

 

Cynthia

qaguy1982
Obsidian | Level 7

Thank you, Cynthia.  I picked off the format with style inside the ^{super 1} command from another paper online  And it worked fine for black superscripts.  I never thought of swapping them.  Also, your hints helped me remove a lot of extra style overrides, so my new code is much less busy than before. I used red in my example just to be able to demonstrate both the white and black printing.    Also, your hint to break up the text into individual lines for the proc report was also helpful.  

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 2086 views
  • 0 likes
  • 2 in conversation