I'm working with a many:1 dataset where each observation represents a single insurance policy tranche ("layer") of a larger "tower" of insurance. Each tower is uniquely identified by towerid. Instead of using the command:
tab company
to get a count of individual tranches underwritten by each insurance company, I would like to get a table of frequencies counting how many towers each insurance company is associated with (i.e. underwrote at least one layer). Is there a less cumbersome approach than creating individual binaries for each insurance company and using
collapse ..., by(towerid)
Further complicating things, there are 105 unique insurance companies in my dataset, which might be too many to display using tab.
* Example generated by -dataex-. For more info, type help dataex
clear
input int towerid byte tranche str10 company
1001 1 "Company A"
1001 2 "Company B"
1001 3 "Company D"
1001 4 "Company A"
1002 1 "Company D"
1002 2 "Company B"
1002 3 "Company C"
1002 4 "Company A"
1003 1 "Company A"
1003 2 "Company C"
1003 3 "Company A"
1003 4 "Company D"
1003 5 "Company A"
1004 1 "Company A"
1004 2 "Company B"
end
Company | n Towers |
Company A | 4 |
Company B | 3 |
Company C | 2 |
Company D | 3 |
0 Response to Tabulating (counting) within many groups in a dataset does one company appear
Post a Comment