Sample 48123: Annotate special symbols as axis values
The sample code on the
Full Code tab uses the SAS® 9.3 TS1M1 SG Annotation to place Unicode values for special symbols as the axis values.
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 uses the SAS 9.3 TS1M1 SG Annotation to place Unicode values for special symbols as the axis values.
proc template;
define style unifonts;
parent=Styles.meadow;
style Graphfonts from GraphFonts /
'GraphValueFont' = ("Monotype Sans WT J",12pt)
'GraphLabelFont' = ("Monotype Sans WT J",12pt)
'GraphDataFont' = ("Monotype Sans WT J",12pt)
'GraphTitleFont' = ("Monotype Sans WT J",12pt)
'GraphFootnoteFont'=("Monotype Sans WT J",12pt)
'GraphAnnoFont'=("Monotype Sans WT J",12pt);
end;
run;
proc format;
value agefmt
low-39 = "Under 40"
40-50 = "40 to 50 Years"
51-70 = "51 to 70 Years"
71-high = "Over 70";
run;
proc freq data=sashelp.heart noprint ;
where status = "Dead";
format ageatdeath agefmt.;
tables ageatdeath / out=ages;
run;
data anno;
set ages;
retain function 'text' x1space 'datavalue' y1space 'wallpercent' y1 -4 width 30;
length label $50 textcolor $8;
select;
when (ageatdeath<39) do;
textcolor='CX99000D';
label="(*ESC*){unicode '003C'x} 40";
end;
when (40 <= ageatdeath <=50) do;
textcolor='red';
label="40 (*ESC*){unicode '2264'x} 50";
end;
when (51 <= ageatdeath <= 70) do;
textcolor='cxFB6A4A';
label="60 (*ESC*){unicode '2264'x} 70";
end;
when (ageatdeath > 70) do;
textcolor='cxFC9272';
label="(*ESC*){unicode '003E'x} 70";
end;
otherwise textcolor='black';
end;
xc1=put(ageatdeath,agefmt.);
run;
ods html style=unifonts;
title 'Heart Related Deaths by Age';
proc sgplot data=sashelp.heart sganno=anno pad=(bottom=5%);
format ageatdeath agefmt.;
vbar ageatdeath / group=deathcause groupdisplay=cluster;
xaxis display=(nolabel novalues noticks);
yaxis label='Count';
keylegend / location=inside position=topleft across=1;
run;
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 uses the SAS® 9.3 TS1M1 SG Annotation to place Unicode values for special symbols as the axis values.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGPLOT
|
Date Modified: | 2012-10-12 15:46:02 |
Date Created: | 2012-10-10 16:26:04 |
Operating System and Release Information
SAS System | Base SAS | Aster Data nCluster on Linux x64 | 9.3 TS1M1 | |
DB2 Universal Database on AIX | 9.3 TS1M1 | |
DB2 Universal Database on Linux x64 | 9.3 TS1M1 | |
Greenplum on Linux x64 | 9.3 TS1M1 | |
Netezza TwinFin 32bit blade | 9.3 TS1M1 | |
Netezza TwinFin 32-bit SMP Hosts | 9.3 TS1M1 | |
Netezza TwinFin 64-bit S-Blades | 9.3 TS1M1 | |
Netezza TwinFin 64-bit SMP Hosts | 9.3 TS1M1 | |
Teradata on Linux | 9.3 TS1M1 | |
z/OS | 9.3 TS1M1 | |
Z64 | 9.3 TS1M1 | |
Microsoft® Windows® for x64 | 9.3 TS1M1 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M1 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.3 TS1M1 | |
Microsoft Windows Server 2003 Standard Edition | 9.3 TS1M1 | |
Microsoft Windows Server 2003 for x64 | 9.3 TS1M1 | |
Microsoft Windows Server 2008 | 9.3 TS1M1 | |
Microsoft Windows Server 2008 for x64 | 9.3 TS1M1 | |
Microsoft Windows XP Professional | 9.3 TS1M1 | |
Windows 7 Enterprise 32 bit | 9.3 TS1M1 | |
Windows 7 Enterprise x64 | 9.3 TS1M1 | |
Windows 7 Home Premium 32 bit | 9.3 TS1M1 | |
Windows 7 Home Premium x64 | 9.3 TS1M1 | |
Windows 7 Professional 32 bit | 9.3 TS1M1 | |
Windows 7 Professional x64 | 9.3 TS1M1 | |
Windows 7 Ultimate 32 bit | 9.3 TS1M1 | |
Windows 7 Ultimate x64 | 9.3 TS1M1 | |
Windows Vista | 9.3 TS1M1 | |
Windows Vista for x64 | 9.3 TS1M1 | |
64-bit Enabled AIX | 9.3 TS1M1 | |
64-bit Enabled HP-UX | 9.3 TS1M1 | |
64-bit Enabled Solaris | 9.3 TS1M1 | |
HP-UX IPF | 9.3 TS1M1 | |
Linux | 9.3 TS1M1 | |
Linux for x64 | 9.3 TS1M1 | |
Solaris for x64 | 9.3 TS1M1 | |