BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Judy518
Calcite | Level 5

Hi there,

 

I was using proc sgplot to make a scatter plot and wanted the fonts for both label and legend be Times New Roman, but it didn't work for the following code.  All the other options of labelattrs such as weight, size, color worked. Any ideas about this?

 

ods graphics/reset imagename="AF" imagefmt=png;
Proc sgplot data=Model noborder ;
scatter x= AC  y= FR/jitter jitterwidth=0.2 markerattrs=(size=5);
xaxis values=(0 to 7 by 1) label= " Rating by Rater1" labelattrs=(weight=bold   size=14   family="Times New Roman"    color=red);
yaxis values=(0 to 7 by 1) label= "Rating by Rater2" labelattrs=(weight=bold size=11    family="Times_New_Roman");
inset " P value < 0.0001"/position=top
textattrs=(size=12 weight=bold family="Times New Roman" color=red) noborder ;
run;

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
ballardw
Super User

You do not say where  the font is not displaying correctly. Since your YAXIS statement spells the font differently I would not expect it to.

On my system using "Times New Roman" does work for the Axis statements using a different data set. I can't test your INSET as I am too lazy to completely fake such and you did not provide example data for the plot.

My code which uses a SAS supplied data set you should have to test the code. Since my values are different I do not attempt to use your values and used a different label so it is obvious that this is not your data.

Proc sgplot data=sashelp.class noborder ;
scatter x= height  y= weight/jitter jitterwidth=0.2 markerattrs=(size=5);
xaxis  label= "Student Height" labelattrs=(weight=bold size=14   family="Times New Roman"    color=red);
yaxis  label= "Student Weight" labelattrs=(weight=bold size=11   family="Times New Roman");
;
run;

Depending on your system the font names might differ in details of the name used.

 


@Judy518 wrote:

Hi there,

 

I was using proc sgplot to make a scatter plot and wanted the fonts for both label and legend be Times New Roman, but it didn't work for the following code.  All the other options of labelattrs such as weight, size, color worked. Any ideas about this?

 

ods graphics/reset imagename="AF" imagefmt=png;
Proc sgplot data=Model noborder ;
scatter x= AC  y= FR/jitter jitterwidth=0.2 markerattrs=(size=5);
xaxis values=(0 to 7 by 1) label= " Rating by Rater1" labelattrs=(weight=bold   size=14   family="Times New Roman"    color=red);
yaxis values=(0 to 7 by 1) label= "Rating by Rater2" labelattrs=(weight=bold size=11    family="Times_New_Roman");
inset " P value < 0.0001"/position=top
textattrs=(size=12 weight=bold family="Times New Roman" color=red) noborder ;
run;

 

Thanks!


 

sbxkoenk
SAS Super FREQ

How to get PROC SGPLOT to convert all fonts to Times New Roman on PDF?

https://communities.sas.com/t5/SAS-Programming/How-to-get-PROC-SGPLOT-to-convert-all-fonts-to-Times-...

 

BR, Koen

Judy518
Calcite | Level 5

Thank you all so much for your response.

 

The solution was to change "Times New Roman" to "Times New Roman Uni"

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1890 views
  • 3 likes
  • 3 in conversation