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

st: RE: matched data

From   "Nick Cox" <>
To   <>
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 =

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?

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 < .


*   For searches and help try:

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