When I run the following, I get 37.96% for dog under year 1 and 34.57% for dog under year 2.
With the data given, it should be 287.1/(469.9+287.1) = 37.926% for dog under year 1 and 261.6/(494.3+287.1) = 34.61% for dog under year 2.
Am I missing something in the code? Why aren't the percentages coming out right? Please see attached.
Thanks!
data test1;
input year cat $3. num;
datalines;
1 cat 469.9
1 dog 287.1
2 cat 494.3
2 dog 261.6
;
run;
goptions reset=all;
proc gchart data=test1;
vbar year / discrete subgroup=cat
group=year g100 nozero
freq=num type=percent
inside=percent width=20;
run;
quit;