BookmarkSubscribeRSS Feed
mariko5797
Pyrite | Level 9

I am trying to get 410 to subscript in the y-axis label. As written below, I end up with a label looking like this: 

mariko5797_0-1657825635690.png 

With labelattrs= GraphUnicodeText, I can get my subscript, but I lose my font style. How can I get the y-axis label to show the subscript while maintaining the font specified in proc template?

 

ods escapechar= '^';
proc template;
	  define style styles.myjournal2;                                              
      		parent=styles.journal;
      		style GraphBar from GraphComponent/displayopts="fill outline ";                                 
			style GraphDataText from GraphDataText/font=('Times New Roman', 9pt);

			class GraphFonts
				"Fonts used in graph styles" /
				'GraphValueFont' = ("<MTserif>, Times New Roman", 10pt)
				'GraphLabelFont' = ("<MTserif>, Times New Roman", 10pt)
				'GraphAnnoFont' = ("<MTserif>, Times New Roman", 10pt);
			class GraphWalls / frameborder = off;
  	  end;
run;

ods listing gpath= "<pathway>" style= styles.myjournal2;
ods graphics / reset= index attrpriority= none noborder imagename= "Fig_immuno_corr_smear" imagefmt= png;

proc sgplot data= _work_;
 styleattrs datacolors= (blue gold gray lightred)
			datacontrastcolors= (blue gold gray lightred)
 			datasymbols= (asterisk circle plus star)
			datalinepatterns= (solid mediumdash dashdotdot shortdashdot);
 reg y= igg x= phady / group= aphase clm clmtransparency= 0.9 jitter;
 	xaxis label= "Day of Positive Blood Smear";
	yaxis label= "Day 1 Anti-CSP IgG Reactivity (Baseline-adjusted OD^{unicode '2084'x}^{unicode '2081'x}^{unicode '2080'x})" /*labelattrs= GraphUnicodeText*/;

	legenditem type= markerline name= "_1" / label= "Dose 1" lineattrs= (pattern= solid color= blue) markerattrs= (symbol= asterisk color= blue);
	legenditem type= markerline name= "_2" / label= "Dose 2" lineattrs= (pattern= mediumdash color= gold) markerattrs= (symbol= circle color= gold);
	legenditem type= markerline name= "_3" / label= "Dose 3" lineattrs= (pattern= dashdotdot color= gray) markerattrs= (symbol= plus color= gray);
	legenditem type= markerline name= "_4" / label= "Dose 4" lineattrs= (pattern= shortdashdot color= lightred) markerattrs= (symbol= star color= lightred);
	keylegend "_1" "_2" "_3" "_4" / title= "Dose" noborder;
run;

ods _all_ close;

 

1 REPLY 1
Ksharp
Super User

ods graphics/width=800px height=600px ;
proc sgplot data=sashelp.class;
  xaxis label= "Day of Positive Blood Smear";
yaxis label= "Day 1 Anti-CSP IgG Reactivity (Baseline-adjusted OD(*ESC*){unicode '2084'x}(*ESC*){unicode '2081'x}(*ESC*){unicode '2080'x})" 
labelattrs= GraphUnicodeText
labelattrs=(size=20);

   scatter x=weight y=height / group=sex;
run;

Ksharp_0-1657892557826.png

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1102 views
  • 2 likes
  • 2 in conversation