still_learning
still_learning

Reputation: 806

Percentage within a group

I am trying to compute the frequency of observation in a group. My dataset looks like:

Date Account C_group Age ...
1    152627    A     28
2    152627    B     28
1    163718    B     32
3    163628    D     12
4    163717    C     41
.
.

I would like to determine the percentage of accounts in the different groups. Do you know how I could that?

Thanks

Upvotes: 0

Views: 1183

Answers (1)

Tim Rykken
Tim Rykken

Reputation: 28

The following should get you close to what you are looking for:

data dset   ;
input
freqgroup $
subgroup    ;
datalines ;
A 12
B 12
C 12
C 21
C 23
A 12
A 21
B 12
B 21
B 21
;
run;
proc sort data=dset;
by freqgroup;
run;
proc freq data=dset ;
    table freqgroup ;
run ;
proc freq data=dset ;
    by freqgroup    ;
    table subgroup  ;
run ;

Upvotes: 1

Related Questions