Sample 49694: Display Unicode values in tick values with the Graph Template Language (GTL)
Beginning with SAS® 9.3, you can use annotation statements with the Graph Template Language (GTL) to display Unicode values as part of the tick values. In order to display Unicode values, you need to define a font that supports Unicode values in your style template.
In the sample code on the Full Code tab, the Monotype Sans WT J font is used in the style template for the style UNIFONTS. This style is referenced with the STYLE option in the ODS destination statement. Unicode values are specified in the form {Unicode '2264'x}.
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.
Beginning with SAS 9.3, you can use annotation statements with the Graph Template Language (GTL) to display Unicode values as part of the tick values. In order to display Unicode values, you need to define a font that supports Unicode values in your style template. In the following example, the Monotype Sans WT J font is used in the style template for the style UNIFONTS. This style is referenced with the STYLE option in the ODS destination statement. Unicode values are specified in the form {Unicode '2264'x}.
proc template;
define style unifonts;
parent=Styles.htmlblue;
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 template;
define statgraph unicodes;
begingraph;
entrytitle 'Cause of Death';
entryfootnote ' ' / textattrs=(size=10);
layout overlay / xaxisopts=(display=(line)) yaxisopts=(label='count');
barchart x=ageatdeath / group=deathcause groupdisplay=cluster name='bars';
discretelegend 'bars' / location=inside halign=left valign=top across=1;
drawtext '>40' / xspace=datavalue yspace=datavalue y=-6 width=30
x='Under 40';
drawtext '40 ' {unicode '2264'x}' 50' / xspace=datavalue
yspace=datavalue y=-6 width=30
x='40 to 50 Years';
drawtext '51 ' {unicode '2264'x}' 70' / xspace=datavalue
yspace=datavalue y=-6 width=30
x='51 to 70 Years';
drawtext 'Over 70' / xspace=datavalue yspace=datavalue y=-6 width=30
x='Over 70';
drawtext 'Age Group' / xspace=datapercent yspace=datavalue y=-25 width=30 x=50 justify=center;
endlayout;
endgraph;
end;
run;
ods html style=unifonts ;
ods graphics / antialiasmax=3000;
proc sgrender data=sashelp.heart template=unicodes;
where ageatdeath ne .;
format ageatdeath agefmt.;
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.
Display Unicode values in tick values with the Graph Template Language (GTL).
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGRENDER
|
Date Modified: | 2020-01-20 15:45:02 |
Date Created: | 2013-04-19 10:35:53 |
Operating System and Release Information
SAS System | Base SAS | Aster Data nCluster on Linux x64 | 9.3 TS1M0 | |
DB2 Universal Database on AIX | 9.3 TS1M0 | |
DB2 Universal Database on Linux x64 | 9.3 TS1M0 | |
Greenplum on Linux x64 | 9.3 TS1M0 | |
Netezza TwinFin 32bit blade | 9.3 TS1M0 | |
Netezza TwinFin 32-bit SMP Hosts | 9.3 TS1M0 | |
Netezza TwinFin 64-bit S-Blades | 9.3 TS1M0 | |
Netezza TwinFin 64-bit SMP Hosts | 9.3 TS1M0 | |
Teradata on Linux | 9.3 TS1M0 | |
z/OS | 9.3 TS1M0 | |
Z64 | 9.3 TS1M0 | |
Microsoft® Windows® for x64 | 9.3 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.3 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.3 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.3 TS1M0 | |
Microsoft Windows Server 2003 for x64 | 9.3 TS1M0 | |
Microsoft Windows Server 2008 | 9.3 TS1M0 | |
Microsoft Windows Server 2008 for x64 | 9.3 TS1M0 | |
Microsoft Windows XP Professional | 9.3 TS1M0 | |
Windows 7 Enterprise 32 bit | 9.3 TS1M0 | |
Windows 7 Enterprise x64 | 9.3 TS1M0 | |
Windows 7 Home Premium 32 bit | 9.3 TS1M0 | |
Windows 7 Home Premium x64 | 9.3 TS1M0 | |
Windows 7 Professional 32 bit | 9.3 TS1M0 | |
Windows 7 Professional x64 | 9.3 TS1M0 | |
Windows 7 Ultimate 32 bit | 9.3 TS1M0 | |
Windows 7 Ultimate x64 | 9.3 TS1M0 | |
Windows Vista | 9.3 TS1M0 | |
Windows Vista for x64 | 9.3 TS1M0 | |
64-bit Enabled AIX | 9.3 TS1M0 | |
64-bit Enabled HP-UX | 9.3 TS1M0 | |
64-bit Enabled Solaris | 9.3 TS1M0 | |
HP-UX IPF | 9.3 TS1M0 | |
Linux | 9.3 TS1M0 | |
Linux for x64 | 9.3 TS1M0 | |
Solaris for x64 | 9.3 TS1M0 | |