The height and vertical alignment of SUB and SUP text commands with GTL are not the same as Unicode values


The height of subscripts and superscripts created with the SUB and SUP text commands in the Graph Template Language (GTL) are larger than subscripts and superscripts that are created using Unicode values.

Subscripts created with the Unicode values do not have the same vertical placement as subscripts created by the SUB text command in GTL. There is not a circumvention for this difference.

The height of the subscript and superscript values can be adjusted with the TEXTATTRS= option. See the Full Code tab for sample code that illustrates the syntax.


Full Code

The height of the subscript and superscript values can be adjusted with the TEXTATTRS= option in GTL. The code below illustrates this.

title;
ods escapechar='^';
%let sup={sup '7'};
%let sub={sub '7'};
%let foot="^{unicode '2077'x}";
%let foot2="^{unicode '2087'x}";

proc template;
   define statgraph superscript;
   begingraph;
      mvar sub sup;
      entrytitle "Superscript" textattrs=(size=8pt) &sup textattrs=(size=12pt) " Subscript" textattrs=(size=8pt) &sub ;
      entryfootnote "Superscript" &foot " Subscript" &foot2;
      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

Graph with Height on the Y axis and Age on the X axis