Hello,
I have employment data on individual observations. There is a dummy variable indicating whether or not an observation was employed. There is also a variable indicating the industry in which an observation worked, taking values of 1-198.
I have created a dummy variable for each occupational industry using the following code:
This generated dummy variables docc1 through docc198.
I now want to create a dummy variable for whether or not an observation is employed in each of these 198 industries. I could repeat the following 198 times:
Doing this 198 times while increasing in numbers would be rather cumbersome. It also seems as though I can't use an asterisk in lieu of increasing numbesr at the end of the empoyed_occ and docc variables. I would like to know if there is an efficient way to generate these variables. Following this I will collapse to the count employed in each industry.
I have employment data on individual observations. There is a dummy variable indicating whether or not an observation was employed. There is also a variable indicating the industry in which an observation worked, taking values of 1-198.
I have created a dummy variable for each occupational industry using the following code:
Code:
tabulate occ1950, generate(docc)
I now want to create a dummy variable for whether or not an observation is employed in each of these 198 industries. I could repeat the following 198 times:
Code:
generate employed_occ1 = 1 if employed==1 & docc1==1
Comment