Raven
Raven

Reputation: 859

Cluster Bar Chart

I have data that look like the following:

data have;
    format date date9.;
    input date:mmddyy10. Intervention _24hrPtVolumeESI_1_5;
    datalines;
9/17/2018 0 204
9/24/2018 0 139
10/17/2018 0 527
10/23/2018 1 430
11/01/2018 1 231
;
run;

I would like to create a bar chart where the x axis contains ranges of median wait time (e.g. 100-125, 126-150 etc.) while displaying those times comparatively based on intervention (0 or 1). Thus, each range would have two bars-one for preintervention (0) and post interventions(1) The Y axis would simply show the counts for how man given median scores fell within the x axis range.

I've tried toying around with a sgplot code but that produces sloppy results.

proc sgplot data=WORK.FelaCombo;
  vbar _24hrPtVolumeESI_1_5 / response=_24hrPtVolumeESI_1_5 stat=sum 
group=intervention nostatlabel
     groupdisplay=cluster;
xaxis display=(nolabel);
 yaxis grid;
run;

Upvotes: 0

Views: 121

Answers (1)

Stu Sztukowski
Stu Sztukowski

Reputation: 12909

Try using a histogram instead. vbar is more for discrete categories, whereas histogram will automatically create bins.

proc sgplot data=WORK.have;
    histogram _24hrPtVolumeESI_1_5 / 
        scale=count 
        binstart=100 
        binwidth=25 
        group=intervention
        transparency=0.5
        showbins
    ;
    xaxis display=(nolabel);
    yaxis grid;
run;

Upvotes: 2

Related Questions