I have a customer_no
and class
.
I would like to calculate ratio from the same column for each customer.
ratio= (number of secured/ total number classes)
customer_no class
1 unsecured
1 secured
1 secured
2 unsecured
2 secured
3 secured
3 unsecured
3 secured
3 unsecured
The output sample will be
customer_no ratio
1 0.666
2 0.50
3 0.50
.
.
.
20000