Can I add the frequency for each group (MAKE) in the below plot? I can generate the plot to check the distribution by MAKE, but I would like to display the exact number of observations (for each MAKE).
ods graphics/height=800px;
proc sgplot data=sashelp.cars;
hbar make;
yaxis display=all fitpolicy=none;
run;
Small correction:
ods graphics/height=800px;
proc sgplot data=sashelp.cars;
hbar make / datalabel;
yaxis display=all fitpolicy=none;
run;
Sorry for the bad display of the code. The below is the same as in the main posting.
ods graphics/height=800px;
proc sgplot data=sashelp.cars;
hbar make;
yaxis display=all fitpolicy=none;
run;
Small correction:
ods graphics/height=800px;
proc sgplot data=sashelp.cars;
hbar make / datalabel;
yaxis display=all fitpolicy=none;
run;
Again, your suggestion worked well for the example I posted.
Then I applied it to my own dataset and SAS tells me the below warning:
WARNING: The data labels are suppressed. Use DATALABELFITPOLICY=NONE to force the labels to be displayed.
When I added DATALABELFITPOLICY=NONE in my code, it works well. Do you know why this option is needed only for some cases?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.