Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: matched data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: matched data
Date   Wed, 2 Oct 2002 19:29:26 +0100

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
n.j.cox@durham.ac.uk

*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index