The text commands SUB and SUP do not resolve when used as dynamic variables with GTL


The SUB and SUP text commands used with the Graph Template Language (GTL) do not resolve to subscript and superscript values, respectively, when specified as dynamic variables. Dynamic variables are not handled at compile time and therefore they do not resolve.

These text commands can be used in macro definitions. Please see the sample code in the Full Code section for an illustration of the syntax.


Full Code

The SUB and SUP text commands used with the Graph Template Language (GTL) do not resolve to subscript and superscript values, respectively, when specified as dynamic variables. Dynamic variables are not handled at compile time and therefore they do not resolve.

These text commands can be used in macro definitions. The code below illustrates this.

title;
%let sup={sup '7'};
%let sub={sub '7'};

proc template;
   define statgraph superscript;
   begingraph;
     mvar sub sup;
     entrytitle "Superscript" textattrs=(size=8pt) ⊃
     entryfootnote "Subscript" textattrs=(size=8pt) ⊂
     layout overlay;
        scatterplot x=age y=height;
     endlayout;
   endgraph;
   end;
run;

proc template;                                                                                                                          
   define style unifonts;                                                                                                                
   parent=Styles.Default;   
   style Graphfonts from GraphFonts /                                                                                                                   
      'GraphValueFont' = ("Monotype Sans WT J",12pt)                                                                                             
      'GraphLabelFont' = ("Monotype Sans WT J",12pt)
      'GraphDataFont' = ("Monotype Sans WT J",12pt)
      'GraphFootnoteFont' = ("Monotype Sans WT J",12pt)
      'GraphTitleFont' = ("Monotype Sans WT J",12pt);                                                                                            
   end;
run;

ods listing close;
ods html file='supersub.html' path='.' style=unifonts;
ods graphics on / reset imagefmt=gif width=600px height=400px imagename='subsup';

proc sgrender data=sashelp.class template=superscript;
run;

ods html close;
ods listing;


Results

Chart with scattered dot and Superscript written along the top and Subscript along the bottom