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

Re: st: generating a variable


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   Re: st: generating a variable
Date   Wed, 7 Aug 2002 11:35:06 +0100

Bob Grafstein

I have a pooled cross-sectional data set with thousands of
individual-level observations including a variable that indicates each
individual's state of residence (RES) for the particular year of that
observation.  For each of those years I also have a two-variable data
set.  One variable, with fifty observations, is a list of the states
(STATE).  The other (AGG), with fifty observations, provides aggregate
data for those states.  Is there a way to generate a new variable
which,
appropriate to the year, assigns each individual the aggregate datum
based on the individual's residence?  That is, is there a way short of
the obvious brute-force method?  Thanks.

>>> Use -append- to get the aggregate data into one file.
You can probably do it in a loop over years using -forval-.

Then -merge-.

Either RES or STATE will need to be renamed.

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/



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