BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
braam
Quartz | Level 8

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Small correction:

 

ods graphics/height=800px;
proc sgplot data=sashelp.cars; 
hbar make / datalabel;
yaxis display=all fitpolicy=none;
run;

View solution in original post

4 REPLIES 4
braam
Quartz | Level 8

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;
PeterClemmensen
Tourmaline | Level 20

Small correction:

 

ods graphics/height=800px;
proc sgplot data=sashelp.cars; 
hbar make / datalabel;
yaxis display=all fitpolicy=none;
run;
braam
Quartz | Level 8

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: 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!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1929 views
  • 0 likes
  • 2 in conversation