Hello Community,
I'm having difficulty in creating a bin for each category of the histogram. The problem is one of the response categories has relatively small frequency and when using the sgplot procedure I couldn't create a bin for that category. The SAS Documentation I could find was not helpful enough to solve this issue. I would appreciate your support. Below is an example using sashelp.cars data. Trying 2 different ways: 1. Doesn't create a bin and tick value for all required categories (4, 5, 6, 8), instead creates a bin for non-existing value (10).
proc freq data=sashelp.cars;
where cylinders between 4 and 8;
table cylinders;
run;
proc sgplot data= sashelp.cars;
where cylinders between 4 and 8;
histogram cylinders/nbins=4 binstart=4 showbins dataskin=pressed;
yaxis label='Percent' ;
xaxis label='Cylinder' ;
run;
2. Creates tick values for required categories (4, 5, 6, 8), but not creating a bin for category 5 with a centered tick value.
proc sgplot data=sashelp.cars;
where cylinders between 4 and 8;
histogram cylinders/nbins=4 binstart=4 showbins dataskin=pressed;
yaxis label='Percent';
xaxis label='Cylinder' values=(4 5 6 8) offsetmin=0.2 offsetmax=0.2;
run;
How to fix it in either way, that is to create 4 bins for categories 4, 5, 6, 8 and display tick values in the center of the bin?
... View more