Abby
Abby

Reputation: 23

Use ODS Graphics to produce grouped histogram

I have this data set:

data a1q1;
input    pid    los     age  gender $   temp    wbc anti    service $  ;
cards;
   1          5         30  F                99          82       2       M       
   2         10         73  F                98          52       1       M       
   3          6         40  F                99         122       2       S       
   4         11         47  F                98          42       2       S       
   5          5         25  F                99         112       2       S       
   6         14         82  M                97          61       2       S       
   7         30         60  M               100          81       1       M       
   8         11         56  F                99          72       2       M       
   9         17         43  F                98          72       2       M       
  10          3         50  M                98         122       1       S       
  11          9         59  F                98          72       1       M       
  12          3          4  M                98          32       2       S       
  13          8         22  F               100         111       2       S       
  14          8         33  F                98         141       1       S       
  15          5         20  F                98         112       1       S       
  16          5         32  M                99          92       2       S       
  17          7         36  M                99          61       2       S       
  18          4         69  M                98          62       2       S       
  19          3         47  M                97          51       2       M       
  20          7         22  M                98          62       2       S       
  21          9         11  M                98         102       2       S       
  22         11         19  M                99         141       2       S       
  23         11         67  F                98          42       2       M       
  24          9         43  F                99          52       2       S       
  25          4         41  F                98          52       2       M       
;

I need to use PROC SGPLOT to output an identical, if not, similar barchart that would be outputted from the following PROC:

proc gchart data = a1q1;
vbar wbc / group = gender;
run;

I need PROC SGPLOT to group the two genders together and not stack them. I have tried coding this way but to no avail:

proc sgplot data = a1q1;
vbar wbc / group= gender response =wbc stat=freq nostatlabel;
run;

How would I go about coding to get the output I need?

Thank you for your time!

Upvotes: 1

Views: 234

Answers (1)

Joe
Joe

Reputation: 63424

Sounds like you should use SGPANEL, not SGPLOT. SGPLOT can make grouped bar charts, but not automatically make histogram bins without using a format (you could do that if you want) and doesn't support group with the histogram plot. However, SGPANEL can handle that.

proc sgpanel data=a1q1;
 panelby gender;
 histogram wbc;
run;

Upvotes: 1

Related Questions