When using PROC SGRENDER,
any required data transformations or computations must take place
before a template is executed. The transformations therefore require
an intermediate step. For example, the following code performs data
transformations on the HEIGHT and WEIGHT variables that are in the
data set SASHELP.CLASS. The transformations are stored in a temporary
data set named CLASS, which is then used on PROC SGRENDER to produce
a graph:
data class;
set sashelp.class;
height=height*2.54;
weight=weight*.45;
label height="Height in CM" weight="Weight in KG";
run;
proc sgrender data=class template=mygraphs.scatter;
run;
When executing a template
with a DATA step, the same DATA step that builds the data object can
perform any required data transformations or computations. An intermediate
data set is not needed. This next example produces the same graph
that the previous example produced with PROC SGRENDER:
data _null_;
set sashelp.class;
height=height*2.54;
weight=weight*.45;
label height="Height in CM" weight="Weight in KG";
file print ods=(template="mygraphs.scatter");
put _ods_;
run;