Graphics Programming

Data visualization using SAS programming, including ODS Graphics and SAS/GRAPH. Charts, plots, maps, and more!
BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,
I would like to make a boxplot with SGRENDER. I am using customized format for the values of my independent variable. Now, I wanna add a superscript "[1]" in my format value and let it appear in the picture. By the way, my destination is RTF. How shall I make it? Thanks in advance!

Below is my code:

proc format;
value study 1='Neonates'
2='Infants'
3='Toddlers'
5='Children'
6='Adolencents'
7='Adults(K)\{super [1]}' /*This \{super [1]} does not work*/
11='Adults(S)'
;
run;

proc template;
define style Styles.boxplot;
parent = styles.statistical;
style GraphBox from Graphbox/
capstyle = "bracket";

style GraphBoxMean from GraphBoxMean /
markersymbol=" diamondfilled "
contrastcolor=GraphColors("gcdata1")
markersize = 3px;

end;

define statgraph box;
begingraph;
layout lattice /columns=1 rows=2;
layout overlay;
boxplot y=bw x=stud /display=(CAPS FILL MEAN MEDIAN NOTCHES OUTLIERS);
endlayout;
layout overlay;
boxplot y=pna x=stud /display=(CAPS FILL MEAN MEDIAN NOTCHES OUTLIERS);
endlayout;
endlayout;
endgraph;
end;
run;

ods rtf style= Journal;
ods ESCAPECHAR="\";
proc sgrender data=summary template=box;
run;
ods rtf close;
1 REPLY 1
KarlK
Fluorite | Level 6
Maurice,

This is a long shot, so if it doesn't work, I won't be surprised and apologize in advance for wasting the bandwidth.

Try changing your escapechar, to something like '^'. In my experience, '\' is unreliable as an escapechar. Why? I don't know for sure, but my theory is that: 1)
windows tries to use it as a sub-directory separator as in unix and gets confused in the ods context; 2) the RTF specification uses it as it's own escape character and ODS and RTF may be interacting in some way and so it doesn't behave as expected.

As I say, it's a long shot. Good luck.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 1 reply
  • 1050 views
  • 0 likes
  • 2 in conversation