Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: how to create a variable by a reference group


From   Mirko <[email protected]>
To   [email protected]
Subject   st: how to create a variable by a reference group
Date   Mon, 14 May 2007 22:17:39 +0100

Dear Statalister,
I would like to create a variable as follows.
Suppose I would like to compare the income (y) of individual i with
the income of his reference group (yref) (based on age, education and
region).
In particular I need to create a variable of the average income of the people
a) living in the same region as i; AND
b) with the same education level as i; AND
c) who are 5 years younger and 5 years older than i.
Where region and education are categorical variables that takes value
from 1 to J (for region) and to K (for education) and age is a
continuous variable.
Without age, the variable can be generated easily using the following:

bysort region educ: egen yref=mean(y)

The problem is how to tell to Stata the reference group of age in that way.

Any help and suggestion would be greatly appreciated!
Thanks a lot in advance,

Mirko
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index