Team,
I have used the following code to and got the following plot.
proc sgplot data=data;
vbar n/response=result datalabel=result_1;
run;
Now I wanted to color those bars by cohort, if I am using the same code by adding after group=cohort after vbar n / then colors are getting applied but unfortunately datalabels are not getting applied. Can anyone help me with that.
proc sgplot data=data;
vbar n/ group=cohort response=result datalabel=result_1;
run;
Try adding option " groupdisplay=cluster "
proc summary data=sashelp.heart nway; class ageatstart; var weight; output out=have sum=; run; data have; set have; if ageatstart<30 then flag=1; else if ageatstart<50 then flag=2; else flag=3; run; proc sgplot data=have; vbarparm category=ageatstart response=weight/group=flag datalabel=weight groupdisplay=cluster; run;
Try adding option " groupdisplay=cluster "
proc summary data=sashelp.heart nway; class ageatstart; var weight; output out=have sum=; run; data have; set have; if ageatstart<30 then flag=1; else if ageatstart<50 then flag=2; else flag=3; run; proc sgplot data=have; vbarparm category=ageatstart response=weight/group=flag datalabel=weight groupdisplay=cluster; run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.