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
Pyrite | Level 9

Wonderful @Ksharp ! Thank you!

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Associate Data Analyst
Actu-Real

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 8 replies
  • 1687 views
  • 5 likes
  • 4 in conversation