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;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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