Theodoropoulos, N.
>
> I am using an employee-employer matched dataset. After
> merging the datasets I want to generate a dummy variable
> that captures workplaces with at least a positive
> (non-zero) proportion of say skilled workers who have a
> positive view about their managers.
> Its workplace in the data can be identified by a unique identifier.
> How can I make sure that I pick-up those workplaces in
> which skilled employees have a positive view about their managers?
Suppose the variables are
employer employee managers_are_great
. bysort employer (managers_are_great) : gen some_positive =
managers_are_great[_N]
The logic is explained at
How do I create a variable recording whether any members of a group
(or all members of a group) possess some characteristic?
http://www.stata.com/support/faqs/data/anyall.html
which contains an -egen- approach to the same problem,
and in Stata Journal 2(1), 86-102 (2002).
The last explains a wrinkle: what if -managers_are_great- were
ever missing? There are various ways round that. One is
. egen some_positive = sum(managers_are_great), by(employer)
. replace some_positive = some_positive > 0 if some_positive < .
Nick
[email protected]
*
* 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/