<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Both superscript and supscript are not working in proc sgplot in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Both-superscript-and-supscript-are-not-working-in-proc-sgplot/m-p/463502#M15970</link>
    <description>&lt;P&gt;I am trying to get some special character in the graph but failed. Both superscript and supscript are not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods rtf file="C:\work\test.rtf";
goptions reset=all;
ods escapechar="^";
ods graphics on / attrpriority=none noborder;
PROC SGPLOT DATA = Srp2;
format tp tpa.;
styleattrs datacontrastcolors=(grey) datasymbols=(circlefilled trianglefilled circle) datalinepatterns=(solid longdash dot);

SERIES X = tp Y = mean/ group=surg_grp name="Surgical Method" lineattrs=(thickness=2) MARKERS markerattrs=(size=8 color=black);
XAXIS label="Time" TYPE = DISCRETE ;
YAXIS LABEL = "SR^{sub P} (2 Chamber) (s^{super -1})" VALUES = (0 TO 10 BY 1);
TITLE "SR^{sub P} (2 Chamber) Trend by Surgical Method";
keylegend "Surgical Method";
RUN; 
ods graphics off;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The graph is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot.png" style="width: 434px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20616iBC4DD51D573E2BC7/image-dimensions/434x325?v=v2" width="434" height="325" role="button" title="SGPlot.png" alt="SGPlot.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did find some discussion about this but looks like it did not really solved!&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-both-a-subscript-and-a-superscript-to-a-variable-in/td-p/403353" target="_self"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-both-a-subscript-and-a-superscript-to-a-variable-in/td-p/403353&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone have any suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
    <pubDate>Sat, 19 May 2018 12:23:56 GMT</pubDate>
    <dc:creator>Andrea_Peng</dc:creator>
    <dc:date>2018-05-19T12:23:56Z</dc:date>
    <item>
      <title>Both superscript and supscript are not working in proc sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Both-superscript-and-supscript-are-not-working-in-proc-sgplot/m-p/463502#M15970</link>
      <description>&lt;P&gt;I am trying to get some special character in the graph but failed. Both superscript and supscript are not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods rtf file="C:\work\test.rtf";
goptions reset=all;
ods escapechar="^";
ods graphics on / attrpriority=none noborder;
PROC SGPLOT DATA = Srp2;
format tp tpa.;
styleattrs datacontrastcolors=(grey) datasymbols=(circlefilled trianglefilled circle) datalinepatterns=(solid longdash dot);

SERIES X = tp Y = mean/ group=surg_grp name="Surgical Method" lineattrs=(thickness=2) MARKERS markerattrs=(size=8 color=black);
XAXIS label="Time" TYPE = DISCRETE ;
YAXIS LABEL = "SR^{sub P} (2 Chamber) (s^{super -1})" VALUES = (0 TO 10 BY 1);
TITLE "SR^{sub P} (2 Chamber) Trend by Surgical Method";
keylegend "Surgical Method";
RUN; 
ods graphics off;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The graph is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot.png" style="width: 434px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20616iBC4DD51D573E2BC7/image-dimensions/434x325?v=v2" width="434" height="325" role="button" title="SGPlot.png" alt="SGPlot.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did find some discussion about this but looks like it did not really solved!&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-both-a-subscript-and-a-superscript-to-a-variable-in/td-p/403353" target="_self"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-add-both-a-subscript-and-a-superscript-to-a-variable-in/td-p/403353&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone have any suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 12:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Both-superscript-and-supscript-are-not-working-in-proc-sgplot/m-p/463502#M15970</guid>
      <dc:creator>Andrea_Peng</dc:creator>
      <dc:date>2018-05-19T12:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Both superscript and supscript are not working in proc sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Both-superscript-and-supscript-are-not-working-in-proc-sgplot/m-p/463568#M15971</link>
      <description>&lt;P&gt;Using an annotation data set might work.&amp;nbsp; In the program below, I used the SASHELP.CLASS data set.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods rtf 
    file='/folders/myfolders/ODS Graphics/subscripts_and_superscripts_via_annotations_PROC_SGPLOT.rtf'
    style=HTMLBlue; 
ods pdf file='/folders/myfolders/ODS Graphics/subscripts_and_superscripts_via_annotations_PROC_SGPLOT.pdf'; 


ods escapechar="^";
ods graphics on / attrpriority=none noborder;

* you can use data step coding to set up the annotations, but it can get complicated
* quickly. ;

data anno;
 infile datalines dlm='#';
 length function $ 8 label $ 50 drawspace $ 12 textweight $ 4 justify $ 6;
 input function $ drawspace $ rotate width textweight $ justify $ x1 y1 discreteoffset label $;
 datalines;         
 text # graphpercent # 90 # 50 # bold # center # 2 # 50 # -0.5 # SR^{sub 'P'} (2 Chamber) (s^{sup '-1'})
 text # graphpercent # 0 # 50 # bold # center # 50 # 98 # -0.5 # SR^{sub 'P'} (2 Chamber) Trend by Surgical Method
    ; 
run;

* used the pad option on PROC SGPLOT to create room for the annotations.  
* otherwise, they may end up jammed too close to the plot. ;

proc sgplot data=sashelp.class pad=(left=20 top=20) sganno=anno;
	scatter x=weight y=height;
	yaxis display=(nolabel);
run;

* SAS provides a bunch of macros to do annotation, which is the easier way! ;

%sganno;

%let yaxislabel=SR(*ESC*){sub 'P'} (2 Chamber) (s(*ESC*){sup '-1'});

%let titlelabel=SR^{sub 'P'} (2 Chamber) Trend by Surgical Method;

data anno_via_macros;
  %sgtext(drawspace="wallpercent", x1=-20, y1=40, width=70, rotate=0, 
          textweight="bold", justify="center",
          label="&amp;amp;yaxislabel");
  %sgtext(drawspace="wallpercent", x1=50, y1=105, width=70, rotate=0,
          textweight="bold", justify="center",
          label="&amp;amp;titlelabel");
run;

proc sgplot data=sashelp.class pad=(left=30pct top=10pct) sganno=anno_via_macros;
	scatter x=weight y=height;
	yaxis display=(nolabel);
run;

ods rtf close;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The y axis label text looks fine in the Results Viewer, but when I opened the RTF, the term involving the negative exponent was jumbled.&amp;nbsp; When I opened the PDF, there was a gap between the s and the negative exponent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried adding some extra space to the left side of the graphic, so that the annotation for the y axis would fit if I didn't rotate it.&amp;nbsp; The term involving the negative exponent looks as expected in the RTF output.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found Dan Heath's paper &lt;A href="https://www.mwsug.org/proceedings/2016/DV/MWSUG-2016-DV10-SAS.pdf" target="_blank"&gt;Annotating the ODS Graphics Way!&lt;/A&gt; helpful in figuring this out.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 19:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Both-superscript-and-supscript-are-not-working-in-proc-sgplot/m-p/463568#M15971</guid>
      <dc:creator>SuzanneDorinski</dc:creator>
      <dc:date>2018-05-19T19:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Both superscript and supscript are not working in proc sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Both-superscript-and-supscript-are-not-working-in-proc-sgplot/m-p/463597#M15972</link>
      <description>&lt;P&gt;Thanks, Suzanne! Create the data annon is working! I will have a look at&amp;nbsp;&lt;SPAN&gt;Dan Heath's paper!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 May 2018 02:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Both-superscript-and-supscript-are-not-working-in-proc-sgplot/m-p/463597#M15972</guid>
      <dc:creator>Andrea_Peng</dc:creator>
      <dc:date>2018-05-20T02:42:55Z</dc:date>
    </item>
  </channel>
</rss>

