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

I am working in Proc Report with escape character="^". I am trying to apply superscript formatting to a variable and not to specific harcoded text.

For example:

I have 2 columns of data: Product and ProductCit

I would like to have 1 column where Product is the base and ProductCit is the superscript.

 

I've tried doing it in a compute block but can't find syntax that will take a variable name:

compute Product / character length=250 ;

Product=cat(Product,ProductCit) ;
endcomp ;

 

I've also tried adding it as a format to ProductCit in the define statement:

define ProductCit / display style(column)= [] ;

 

I can only seem to find examples where the superscript text is hard coded. Unfortunately, mine will be dynamic and I need to apply the format to the variable. Does anyone know how or have any ideas? I've been reading papers for days!

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
data have;
set sashelp.class;
super=cat(name,'(*ESC*){super ',age,'}');
run;


ods excel file='c:\temp\temp.xlsx';
proc report data=have nowd;
column name age super;
define name/display;
run;
ods excel close;

Ksharp_0-1641901453376.png

 

View solution in original post

8 REPLIES 8
Reeza
Super User

Pretty sure you need to add the escape character to the variable value as well and/or add some style elements to get it properly displayed.

It also likely matters what your final output destination is, RTF, HTML PDF, WORD, PPTX?

jmck
Fluorite | Level 6
Outputting to Excel. .xlsx
Worst case, I had an idea to use macro variables to output the text, but that'll be my last resort before throwing in the towel.
Reeza
Super User
Can you post some fake data with current code to play around with?
Reeza
Super User
FYI - I've moved this post to the reporting forum instead of general programming.
Ksharp
Super User
data have;
set sashelp.class;
super=cat(name,'(*ESC*){super ',age,'}');
run;


ods excel file='c:\temp\temp.xlsx';
proc report data=have nowd;
column name age super;
define name/display;
run;
ods excel close;

Ksharp_0-1641901453376.png

 

jmck
Fluorite | Level 6
Thanks so much! I'll try it as soon as I get on today.
jmck
Fluorite | Level 6
A thousand THANKS!
DrAbhijeetSafai
Lapis Lazuli | Level 10

Wonderful @Ksharp ! Thank you!

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 8 replies
  • 3328 views
  • 5 likes
  • 4 in conversation