☑ This topic is solved.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 07-17-2023 10:01 AM
(1077 views)
I need to create the subscript lower case letter n on the SGPLOT axis. I read online how
to do this using Unicode but it does not work. It displays blank square
instead of a subscript. There is no error or warning messages in the
log. I used the dataset from the SASHELP library so that anyone can ran the code. I am using SAS free server for academics. I am wondering if the problem is with the server rather than with the code itself. The code is below. Please, advise.
ods escapechar='~';
ODS GRAPHICS / ANTIALIASMAX=4100 ATTRPRIORITY=NONE ;
ODS PDF FILE="&reports.SGPLOT_with_subsript_n.pdf";
PROC SGPLOT DATA=SASHELP.CARS;
SCATTER X=LENGTH Y=Weight;
/* Use Unicode for subscript lowercase n */
YAXIS LABEL="W~{unicode '2099'x}"
labelattrs=(size=14pt family='Times New Roman Uni')
;
XAXIS LABEL="L~{unicode '2099'x}"
labelattrs=(size=14pt FAMILY="Times New Roman Uni")
;
RUN;
ODS PDF CLOSE;
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
/*There is no need to use unicode character
if you are using macro %sganno ,just type in it*/
data _anno;
length label $ 200;
drawspace="layoutpercent"; function="text"; textweight="normal"; textsize=12;textcolor="black"; width=200;
x1=50; y1=2.5;label="XXXXX(*ESC*){sub 'n'}"; output;
x1=2.5; y1=50;rotate=90;label="YYYY(*ESC*){sub 'n'}"; output;
run;
proc sgplot data=sashelp.class sganno=_anno noautolegend ;
scatter x=weight y=height/group=sex datalabel=name;
xaxis label=' ';
yaxis label=' ';
run;
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
See this example from @Ksharp
--
Paige Miller
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for suggestions. Unfortunately, it does not work. More specifically, the superscript 6 as in your example works but subscript n (Unicode 2099) does not. I am including the code.
data _anno;
length label $ 200;
drawspace="layoutpercent"; function="text"; textweight="normal"; textsize=12;textcolor="black"; width=200;
x1=50; y1=2.5;label="XXXXX(*ESC*){unicode '2099'x}"; output;
x1=2.5; y1=50;rotate=90;label="YYYY(*ESC*){sub '6'}"; output;
run;
proc sgplot data=sashelp.class sganno=_anno noautolegend ;
scatter x=weight y=height/group=sex datalabel=name;
xaxis label=' ';
yaxis label=' ';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
/*There is no need to use unicode character
if you are using macro %sganno ,just type in it*/
data _anno;
length label $ 200;
drawspace="layoutpercent"; function="text"; textweight="normal"; textsize=12;textcolor="black"; width=200;
x1=50; y1=2.5;label="XXXXX(*ESC*){sub 'n'}"; output;
x1=2.5; y1=50;rotate=90;label="YYYY(*ESC*){sub 'n'}"; output;
run;
proc sgplot data=sashelp.class sganno=_anno noautolegend ;
scatter x=weight y=height/group=sex datalabel=name;
xaxis label=' ';
yaxis label=' ';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot. This worked!