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

Hi, I am trying to create bar graphs. the problem that I am having is that width of the bars increase in width when there is no data for some of the academic years. I would like to keep the width of the bars the same irrespective of whether there is missing data for any of the academic years. Thanks.

 

 

title1 "Annual Summary Data Bar Chart";
	pattern1 v=solid color=red;
 	pattern2 v=solid c=blue;
	pattern3 v=solid c=green;
 	pattern4 v=solid c=orange;

Axis1 style=1 width=1 minor=none label=(height=4pt font="arial/bold" angle=90 "Number of Students") value=(height=4pt font="arial" /*"0%" "10%" "20%" "30%" "40%" "50%" "60%" "70%" "80%" "90%" "100%"*/) /*order=0 to 100 by 10*/;
Axis2 style=1 width=2 label=(height=4pt font="arial/bold" "Status") value=(height=4pt font="arial" "Applications" "Enrolled" "Completed" "Graduated");
Axis3 style=1 width=2 label=(height=4pt font="arial/bold" "Academic Year") value=(height=4pt font="arial");

proc gchart data=List205;
	vbar Status / discrete sumvar=UniqueNumberStudents subgroup=Status group=AcademicYearBeg type=sum outside=sum nolegend
		coutline=black raxis=axis1 maxis=axis2 gaxis=axis3 woutline=1 patternid=subgroup gspace=0.5 space=0.25;
	by 'Initial Program'n;
run; 
quit;
1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

Not sure how you can do this with GCHART or SGPLOT.

 

However, one way to do this would be to use the SGPANEL procedure with PANELBY=AcademinYearBeg and the "BY variable".   This will create a panel of graph cells, one for each AcademicYear x BY variable with their values in the headers.  Default is UNISCALE=ALL, so this will show bars for all Status values in each cell with equal bar widths.

 

You can set ROWS=1 to get only one row or cells (all the Year values) in per output graph.

 

See: https://documentation.sas.com/?cdcId=vdmmlcdc&cdcVersion=8.11&docsetId=grstatproc&docsetTarget=p17ww...

 

 

View solution in original post

2 REPLIES 2
Jay54
Meteorite | Level 14

Not sure how you can do this with GCHART or SGPLOT.

 

However, one way to do this would be to use the SGPANEL procedure with PANELBY=AcademinYearBeg and the "BY variable".   This will create a panel of graph cells, one for each AcademicYear x BY variable with their values in the headers.  Default is UNISCALE=ALL, so this will show bars for all Status values in each cell with equal bar widths.

 

You can set ROWS=1 to get only one row or cells (all the Year values) in per output graph.

 

See: https://documentation.sas.com/?cdcId=vdmmlcdc&cdcVersion=8.11&docsetId=grstatproc&docsetTarget=p17ww...

 

 

twildone
Pyrite | Level 9

Thanks Jay for your help...very helpful.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

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
  • 2 replies
  • 458 views
  • 0 likes
  • 2 in conversation