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

Hi,

 

As fas as I could read in the SAS online doc, it is currently not possible to display zero frequencies in a bar char.

 

I could manage to add it using the values options of xaxis statement but the value 0 is not displayed with datalabel and the bar at value zero is also not displayed.

 

Are you aware of any other solution I could consider (format?, other option? vbarbasic?, vbarparm?)

 

 

data cnt;
gender='M'; freq=9; output;
gender='F'; freq=8; output;
gender='X'; freq=0; output;
run;

proc print data=cnt;
run;

ods graphics / width=15cm height=10cm noborder;

proc sgplot data=cnt noborder;
vbar gender / freq=freq missing displaybaseline=off datalabel;
xaxis values=('M' 'F' 'X')
display = (noline);
run;

ods graphics off;

sas_forum.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Here is how I would do it. Example using SASHELP.CLASS data set

 

proc format;
	value $ sexfmt "F"="Female" 
				   "M"="Male" 
				   "X"="X";
run;

proc summary data=sashelp.class nway completetypes;
   class sex / preloadfmt order=formated missing;
   format sex $sexfmt.;
   output out=counts;
run;

proc sgplot data=counts;
	vbarparm category=sex response=_FREQ_ / nozerobars;
run;

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Here is how I would do it. Example using SASHELP.CLASS data set

 

proc format;
	value $ sexfmt "F"="Female" 
				   "M"="Male" 
				   "X"="X";
run;

proc summary data=sashelp.class nway completetypes;
   class sex / preloadfmt order=formated missing;
   format sex $sexfmt.;
   output out=counts;
run;

proc sgplot data=counts;
	vbarparm category=sex response=_FREQ_ / nozerobars;
run;
xxformat_com
Barite | Level 11

Thank you 🙂

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1202 views
  • 0 likes
  • 2 in conversation