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;
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.
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.
Thanks Jay for your help...very helpful.
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 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.