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

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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