Dear Statalist
I am working on a cross-section dataset, with different firms and different individuals. How would one generate a variable which would provide mean workplace years of education:
which is based on percentage of the workforce in each of the k occupations times average years of education for that occupation from worker respondents.
(%OCCjk)*(Greek letter sigma eijk/nk) k = 1, ..., 9
where eij is workers years of education, i is the individual and j is the workplace and k is the occupation.
I generated this variable, call it Ej by egen before. But now I want to run a workplace-level regression on the RHS. So I need to retreive the mean workplace education from the employee dataset which was merged with the employer dataset. Since I am only using the employer-level data now.
Can anyone tell me how I could create this variable mean workplace education, Ej, using "collapse". That way I can retrieve that variable and merge it with the employer data.
Many Thanks in advance
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/