| Overview |
In the GTL, expressions that are enclosed in an EVAL function can be used to define constants and data columns. Within the expression you can use DATA step functions, arithmetic operators, and other special functions supported by the GTL. Text statements like ENTRY and ENTRYTITLE support rich text and have special text commands such as sup , sub , and unicode , which enable subscripting, superscripting, and Unicode characters.
The following example shows how the
symbol is included in the title line using its hexadecimal Unicode value. Also, new data columns are computed for the upper and lower error bars of the scatter plot, based on the input column StdErr. This example also illustrates a very common application theme: using a procedure's output data set as input to a template.
proc template;
define statgraph expression;
begingraph;
entrytitle "Errorbars show " {unicode '00B1'x} '2 SE';
layout overlay;
scatterplot x=age y=meanweight /
yerrorlower=eval(meanweight - 2*stderr)
yerrorupper=eval(meanweight + 2*stderr);
seriesplot x=age y=meanweight;
endlayout;
endgraph;
end;
run;
proc summary data=sashelp.class nway;
class age;
var weight;
output out=weights(drop=_type_ _freq_)
mean=MeanWeight stderr=StdErr;
run;
ods rtf style=listing;
proc print data=weights noobs;
run;
proc sgrender data=weights template=expression;
label meanweight="Mean Weight";
run;
ods rtf close;
Here is the PROC PRINT and SGRENDER output:
| Age | MeanWeight | StdErr |
|---|---|---|
| 11 | 67.750 | 17.2500 |
| 12 | 94.400 | 9.1807 |
| 13 | 88.667 | 4.6667 |
| 14 | 101.875 | 4.6069 |
| 15 | 117.375 | 5.2097 |
| 16 | 150.000 | . |
![]() |
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.