BookmarkSubscribeRSS Feed
knveraraju91
Barite | Level 11

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

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

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).

--
Paige Miller
ChrisNZ
Tourmaline | Level 20

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:

 

GraphCapturegrp.PNG

 

HTMLCapturehtml.PNG

 

PDFCapturepdf.PNG

 

RTFCapturertf.PNG

 

 

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;

 

Ksharp
Super User
title "subject is (*ESC*){unicode 2265} 1";


proc report data=sashelp.class nowd;
define name/style={tagattr="wrap:no"};
run;

x.png

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
  • 3 replies
  • 1186 views
  • 1 like
  • 4 in conversation