BookmarkSubscribeRSS Feed
psh23
Fluorite | Level 6

I would like my yaxis values to have two decimal places, this code does not work:

 

proc sgplot data=week noborder;
format HazardRatio 4.2;
scatter x=week y=HazardRatio / yerrorlower=WaldLower
datalabelattrs=(size=12pt color=black)
yerrorupper=WaldUpper errorbarattrs=(color=black)
markerattrs=hr
(symbol=CircleFilled size=6 color=black);
refline 1 / axis=y lineattrs=(pattern=shortdash) transparency=.5;
yaxis label="Hazard Ratio " min=.96 max=1.06 type=log logbase=10
valueattrs=(size=14pt color=black family="Times New Roman") labelattrs=(size=14pt color=black family="Times New Roman");
xaxis label="Week of Gestation" min=1 max=37
valueattrs=(size=14pt color=black family="Times New Roman") labelattrs=(size=14pt color=black family="Times New Roman") minor;
run;

 

Thanks!image.png

2 REPLIES 2
ballardw
Super User

Try the option VALUESFORMAT=4.2 on the YAXIS statement.

psh23
Fluorite | Level 6

Thanks! valuesformat=4.2 does not work but valuesformat=data does. 


proc sgplot data=week noborder;
/*format HazardRatio 4.2;*/
scatter x=week y=HazardRatio / yerrorlower=WaldLower
datalabelattrs=(size=12pt color=black)
yerrorupper=WaldUpper errorbarattrs=(color=black)
markerattrs=(symbol=CircleFilled size=6 color=black);
refline 1 / axis=y lineattrs=(pattern=shortdash) transparency=.5;
yaxis valuesformat=data label="Hazard Ratio " min=.96 max=1.06 type=log logbase=10
valueattrs=(size=14pt color=black family="Times New Roman") labelattrs=(size=14pt color=black family="Times New Roman") ;
xaxis label="Week of Gestation" min=1 max=37
valueattrs=(size=14pt color=black family="Times New Roman") labelattrs=(size=14pt color=black family="Times New Roman") minor;
run;

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 2 replies
  • 4752 views
  • 1 like
  • 2 in conversation