Dear,
In a macro i am trying to resolve the following unicode value.
ods escapechar='^';
%let title_1=%str(subject have ^{unicode 2265}1);
title=%sysfunc(tranwrd(%superq(title_1),|,%str(\par )));
the resolved value of title variable should be =subject have ≥1
but the resolved value of title is=subject have ^{unicode 2265}1.
The error i am getting is Literal contains unmatched quote.
Please suggest how to resolve this.
Thank you
Do you mean
%let title=%sysfunc(tranwrd(%superq(title_1),|,%str(\par )));
because the statement doesn't mean anything without the %let.
In any event, you have not done anything to resolve the value of the macro variable &title, you are simply assigning text to the macro variable &title, so it should not (yet) be resolved.
If you use &title in a SAS command, such as the TITLE statement, then it should resolve
title "&title";
What happens in that case?
If there are problems, please turn on the options SYMBOLGEN MLOGIC and MPRINT, run it again and show us the SAS log (the entire log, not just the error messages).
The syntax to use Unicode characters varies wildly, depending on where in SAS one uses them.
SAS/GRAPH titles require a different syntax than SAS/GRAPH legends, which is again different from what ODS Graphs understands, which is also different from what ODS reports need.
Here is a summary of my findings. I am just displaying an exponent here, like this:
Graph
HTML
RTF
ODS Graphs seem to behave differently than when I last tested these syntaxes. Oh well...
title; %***************** SAS/GRAPH **********; %let a=%sysfunc(unicodec(TRT A 5x10, utf16b),$hex40.)00b92070; %let b=%sysfunc(unicodec(TRT B 1x10, utf16b),$hex40.)00b900b9; %put &=a ;%put &=b; legend value=(font="arial unicode ms/unicode" "&a"x "&b"x) ; axis value=(font="arial unicode ms/unicode" "&a"x "&b"x font="arial" /* for GIF for next values on axis*/); goptions ypixels=200 xpixels=320 dev=gif; title1 h=1 font="arial unicode ms" "TRT A 5x10^{super 10}" ;* no /unicode; title2 h=1 font="arial unicode ms" "TRT B 1x10^{super 11}" ;* for title!; proc gplot data=SASHELP.CLASS; plot WEIGHT*AGE=SEX/legend=legend1 haxis=axis1; note c=black f='arial unicode ms/unicode' m=(20,50)pct h=3 "&a"x; note c=black f='arial unicode ms/unicode' m=(20,40)pct h=3 "&b"x; run; quit; goptions dev=actximg; title; proc gplot data=SASHELP.CLASS; plot WEIGHT*AGE=SEX/legend=legend1 haxis=axis1; run; quit; %***************** ODS GRAPH **********; proc format ; value $sup_sg 'F'="TRT A 5x10(*ESC*){unicode '00b9'x}(*ESC*){unicode '2070'x}" 'M'="TRT B 1x10(*ESC*){unicode '00b9'x}(*ESC*){unicode '00b9'x}" ; ods graphics on / width=620px height=400px; proc sgpanel data=SASHELP.CLASS; format SEX $sup_sg.; panelby SEX / novarname headerattrs=GraphUnicodeText; scatter x=WEIGHT y=HEIGHT; run; %***************** ODS REPORT **********; ods escapechar='^' noproctitle; proc format ; value $sup_ods 'F'="TRT A 5x10^{super 10}" 'M'="TRT B 1x10^{super 11}" ; proc freq data=SASHELP.CLASS; format SEX $sup_ods.; table SEX; run; data TEST; X="TRT A 5x10^{super 10}"; run; title "TRT A 5x10^{super 12}"; ods rtf file="%sysfunc(pathname(WORK))\test.rtf" ; ods pdf file="%sysfunc(pathname(WORK))\test.pdf" ; ods html file="%sysfunc(pathname(WORK))\test.html" ; ods excel file="%sysfunc(pathname(WORK))\test.xls" ; proc print data=TEST noobs; run; ods _all_ close;
title "subject is (*ESC*){unicode 2265} 1"; proc report data=sashelp.class nowd; define name/style={tagattr="wrap:no"}; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.