Sample 39267: Create subscripts and superscripts in PROC SGPLOT output
The sample code on the Full Code tab illustrates how to use Unicode values to include subscripts and superscripts in the axis labels in SGPLOT procedure output.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The sample code below illustrates how to use Unicode values to include subscripts and superscripts in the axis labels in SGPLOT procedure output.
/* Define sample data for the plot */
data sample;
do x=1 to 10;
y=int(ranuni(0)*100);
output;
end;
run;
/* Modify the ODS path to include the WORK library */
ods path(prepend) work.template(update);
/* Define a custom style to reference a Unicode font */
proc template;
define style unifonts;
parent=Styles.Default;
style Graphfonts from GraphFonts /
'GraphValueFont' = ("Monotype Sans WT J",12pt)
'GraphLabelFont' = ("Monotype Sans WT J",14pt)
'GraphDataFont' = ("Monotype Sans WT J",12pt)
'GraphTitleFont' = ("Monotype Sans WT J",12pt);
end;
run;
/* Define the ODS escape character */
ods escapechar='^';
/* Close the LISTING destination */
ods listing close;
/* Open the HTML destination and reference the custom style */
ods html file='subsuper.html' path='.' style=unifonts;
/* Define the attributes of the image file */
ods graphics / reset width=600px height=400px imagename='SubSuper' imagefmt=gif;
title 'Using Subscripts and Superscripts';
proc sgplot data=sample;
scatter x=x y=y / markerattrs=(symbol=circlefilled color=blue);
/* Specify the 4-digit hex value for the subscript 2 and superscript 2 */
xaxis label="H^{unicode '2082'x}O^{unicode '00b2'x}";
/* Specify the 4-digit hex value for the superscript 2 and subscript 2 */
yaxis label="N^{unicode '00b2'x}H^{unicode '2082'x}";
run;
/* Close the HTML destination and reopen the LISTING destination */
ods html close;
ods listing;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample illustrates how to use Unicode values to include subscripts and superscripts in the axis labels in SGPLOT procedure output.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGPLOT
|
Date Modified: | 2010-04-28 15:28:04 |
Date Created: | 2010-04-05 14:46:47 |
Operating System and Release Information
SAS System | SAS/GRAPH | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |