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