ODS Graphics Template Modification


Unicode and Special Characters

The following steps illustrate Unicode specifications for a number of commonly used characters and create Output 22.2.6 and Output 22.2.7, which are charts of Unicode characters:

%let l = halign=left;
proc template;
   define statgraph class;
      begingraph / designheight=550px designwidth=520px;
         layout overlay / xaxisopts=(display=none) yaxisopts=(display=none);
            layout gridded / columns=3 autoalign=(topleft);
               entry &l textattrs=(weight=bold) 'Description';
               entry &l textattrs=(weight=bold) 'Displayed';
               entry &l textattrs=(weight=bold) "Unicode";
               entry &l 'R Square';
               entry &l 'R' {sup '2'};
               entry &l "'R' {sup '2'}";
               entry &l 'y hat sub i';
               entry &l 'y' {unicode hat}{sub 'i'};
               entry &l "'y' {unicode hat}{sub 'i'}";
               entry &l 'less than or equal       ';
               entry &l 'a ' {unicode '2264'x} ' b';
               entry &l "'a ' {unicode '2264'x} ' b'";
               entry &l 'greater than or equal    ';
               entry &l 'b ' {unicode '2265'x} ' a';
               entry &l "'b ' {unicode '2265'x} ' a'";
               entry &l 'infinity';
               entry &l {unicode '221e'x};
               entry &l "{unicode '221e'x}";
               entry &l 'almost equal';
               entry &l 'a ' {unicode '2248'x} ' b';
               entry &l "'a ' {unicode '2248'x} ' b'";
               entry &l 'combining tilde';
               entry &l 'El nin' {unicode tilde} 'o';
               entry &l "'El nin' {unicode tilde} 'o'";
               entry &l 'grave accent';
               entry &l 'cre' {unicode '0300'x} 'me';
               entry &l "'cre' {unicode '0300'x} 'me'";
               entry &l 'circumflex, acute accent   ';
               entry &l 'bru' {unicode '0302'x} 'le' {unicode '0301'x} 'e';
               entry &l "'bru' {unicode '0302'x} 'le' {unicode '0301'x} 'e'";
               entry &l 'alpha';
               entry &l {unicode alpha} '   ' {unicode alpha_u};
               entry &l "{unicode alpha} '   ' {unicode alpha_u}";
               entry &l 'beta';
               entry &l {unicode beta} '   ' {unicode beta_u};
               entry &l "{unicode beta} '   ' {unicode beta_u}";
               entry &l 'gamma';
               entry &l {unicode gamma} '   ' {unicode gamma_u};
               entry &l "{unicode gamma} '   ' {unicode gamma_u}";
               entry &l 'delta';
               entry &l {unicode delta} '   ' {unicode delta_u};
               entry &l "{unicode delta} '   ' {unicode delta_u}";
               entry &l 'epsilon';
               entry &l {unicode epsilon} '   ' {unicode epsilon_u};
               entry &l "{unicode epsilon} '   ' {unicode epsilon_u}";
               entry &l 'zeta';
               entry &l {unicode zeta} '   ' {unicode zeta_u};
               entry &l "{unicode zeta} '   ' {unicode zeta_u}";
               entry &l 'eta';
               entry &l {unicode eta} '   ' {unicode eta_u};
               entry &l "{unicode eta} '   ' {unicode eta_u}";
               entry &l 'theta';
               entry &l {unicode theta} '   ' {unicode theta_u};
               entry &l "{unicode theta} '   ' {unicode theta_u}";
               entry &l 'iota';
               entry &l {unicode iota} '   ' {unicode iota_u};
               entry &l "{unicode iota} '   ' {unicode iota_u}";
               entry &l 'kappa';
               entry &l {unicode kappa} '   ' {unicode kappa_u};
               entry &l "{unicode kappa} '   ' {unicode kappa_u}";
               entry &l 'lambda';
               entry &l {unicode lambda} '   ' {unicode lambda_u};
               entry &l "{unicode lambda} '   ' {unicode lambda_u}";
               entry &l 'mu';
               entry &l {unicode mu} '   ' {unicode mu_u};
               entry &l "{unicode mu} '   ' {unicode mu_u}";
               entry &l 'nu';
               entry &l {unicode nu} '   ' {unicode nu_u};
               entry &l "{unicode nu} '   ' {unicode nu_u}";
               entry &l 'xi';
               entry &l {unicode xi} '   ' {unicode xi_u};
               entry &l "{unicode xi} '   ' {unicode xi_u}";
               entry &l 'omicron';
               entry &l {unicode omicron} '   ' {unicode omicron_u};
               entry &l "{unicode omicron} '   ' {unicode omicron_u}";
               entry &l 'pi';
               entry &l {unicode pi} '   ' {unicode pi_u};
               entry &l "{unicode pi} '   ' {unicode pi_u}";
               entry &l 'rho';
               entry &l {unicode rho} '   ' {unicode rho_u};
               entry &l "{unicode rho} '   ' {unicode rho_u}";
               entry &l 'sigma';
               entry &l {unicode sigma} '   ' {unicode sigma_u};
               entry &l "{unicode sigma} '   ' {unicode sigma_u}";
               entry &l 'tau';
               entry &l {unicode tau} '   ' {unicode tau_u};
               entry &l "{unicode tau} '   ' {unicode tau_u}";
               entry &l 'upsilon';
               entry &l {unicode upsilon} '   ' {unicode upsilon_u};
               entry &l "{unicode upsilon} '   ' {unicode upsilon_u}";
               entry &l 'phi';
               entry &l {unicode phi} '   ' {unicode phi_u};
               entry &l "{unicode phi} '   ' {unicode phi_u}";
               entry &l 'chi';
               entry &l {unicode chi} '   ' {unicode chi_u};
               entry &l "{unicode chi} '   ' {unicode chi_u}";
               entry &l 'psi';
               entry &l {unicode psi} '   ' {unicode psi_u};
               entry &l "{unicode psi} '   ' {unicode psi_u}";
               entry &l 'omega';
               entry &l {unicode omega} '   ' {unicode omega_u};
               entry &l "{unicode omega} '   ' {unicode omega_u}";
            endlayout;
            scatterplot y=weight x=height / markerattrs=(size=0);
         endlayout;
      endgraph;
   end;
run;
proc sgrender data=sashelp.class template=class;
run;

%macro m(u);
   entry halign=left "(*ESC*){unicode &u.x} {unicode &u.x}" /
         textattrs=GraphValueText (family=GraphUnicodeText:FontFamily);
   %mend;

proc template;
   define statgraph markers;
      begingraph / designheight=510px designwidth=350px;
         layout overlay / xaxisopts=(display=none) yaxisopts=(display=none);
            layout gridded / columns=1 autoalign=(topright);
               entry " ";
               %m('2193')   %m('002A')   %m('25cb')   %m('25cf')
               %m('25c7')   %m('2666')   %m('003e')   %m('0023')
               %m('2336')   %m('002b')   %m('25a1')   %m('25a0')
               %m('2606')   %m('2605')   %m('22a4')   %m('223c')
               %m('25b3')   %m('25b2')   %m('222a')   %m('0058')
               %m('0059')   %m('005a')
            endlayout;
         scatterplot x=x1 y=y / group=m;
         scatterplot x=x2 y=y / markercharacter=m;
         scatterplot x=x3 y=y / markerattrs=(size=0);
         endlayout;
      endgraph;
   end;
run;

%modstyle(name=mark, parent=statistical, markers=
   ArrowDown Asterisk Circle CircleFilled Diamond DiamondFilled GreaterThan
   Hash IBeam Plus Square SquareFilled Star StarFilled Tack Tilde Triangle
   TriangleFilled Union X Y Z, linestyles=1, colors=black)

data x;
   retain x1 1 x2 2 x3 3;
   length m $ 20;
   input m @@;
   y = -_n_;
   datalines;
ArrowDown Asterisk Circle CircleFilled Diamond DiamondFilled GreaterThan
Hash IBeam Plus Square SquareFilled Star StarFilled Tack Tilde Triangle
TriangleFilled Union X Y Z
;

ods listing style=mark;
proc sgrender data=x template=markers;
run;
ods listing;

Output 22.2.6: Commonly Used Unicode and Special Characters

Commonly Used Unicode and Special Characters


Output 22.2.7: Markers, Marker Names, Unicode Characters, Unicode Specifications

Markers, Marker Names, Unicode Characters, Unicode Specifications


The Unicode Consortium http://unicode.org/ provides a list of character codes at
http://www.unicode.org/charts/charindex.html.

The following rules apply to Unicode and special character specifications in ODS graphics:

  • Each character can be specified by looking up its code and specifying it as a hexadecimal constant. Example: $\{ $unicode ’221e’x$\} $.

  • Lower case Greek letters can be specified by using names instead of hexadecimal constants. Example: $\{ $ unicode alpha$\} $.

  • Upper case Greek letters can be specified by using names followed by _u instead of a hexadecimal constants. Example: $\{ $ unicode alpha_u$\} $.

  • Superscript and subscript have special abbreviations. Examples: $\{ $sup 2$\} $ and $\{ $sub 2$\} $.

  • The sup and sub specifications must not appear escaped and in quotes in the GTL. They must appear outside of quotes.

  • Some characters overprint the character that comes before. Example: ’El nin’ $\{ $tilde$\} $ ’o’, which is equivalent to ’El nin’ $\{ $unicode ’0303’x$\} $ ’o’ creates 'El niño'.

  • Specifications inside quotes are escaped. Example: "(*ESC*)$\{ $unicode beta$\} $".

  • Specifications outside quotes are not escaped. Example: $\{ $unicode beta$\} $.