Dear all
1) I want the total number of females per company. I tried the following code:
bysort companyname: gen female = sum(dmgender=="F")
2) I want to create dummy’s, for example:
Dummy Diversity1 if the total number of females of a company = 1
Dummy Diversity2 if the total number of females of a company = 2
Dummy Diversity3 if the total number of females of a company >= 3
How can I do this now, so that one company has one dummy?
The following is my dataex, before trying the 'bysort' code.
Thank you!
1) I want the total number of females per company. I tried the following code:
bysort companyname: gen female = sum(dmgender=="F")
2) I want to create dummy’s, for example:
Dummy Diversity1 if the total number of females of a company = 1
Dummy Diversity2 if the total number of females of a company = 2
Dummy Diversity3 if the total number of females of a company >= 3
How can I do this now, so that one company has one dummy?
The following is my dataex, before trying the 'bysort' code.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str88 companyname str1 dmgender "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "VOLKSWAGEN AG" "M" "" "M" "" "M" "" "F" "" "M" "" "M" "" "M" "" "F" "" "M" "" "F" "" "F" "" "M" "" "F" "" "M" "" "M" "" "M" "" "M" "" "F" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "F" "" "F" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "F" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "F" "" "M" "" "M" "" "F" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" "" "F" "" "M" "" "M" "" "M" "" "M" "" "M" "" "M" end
Thank you!
Comment