Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Linking Cross-Sectional and Time Series IDs


From   Paul <paulburk314@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Linking Cross-Sectional and Time Series IDs
Date   Fri, 10 Aug 2012 15:20:51 -0400

I have repeated cross-sectional data at the individual*firm level,
where individuals may work at multiple firms and are linked within
years by a unique ID, which I'll refer to as crosssection_id.  Each
year the IDs are randomly assigned, so individuals are not linked over
time.  I've painstakingly linked individual*firm observations over
time based on characteristics such as experience and ethnicity,
generating what I'll call year_id.

However, the IDs I've created only link individual*firm observations
over time.  I'd like to now link the IDs so each individual, appearing
in multiple firms and years, has one ID.

I've devised the following (probably inefficient) method for linking IDs:

sort year crosssection_id year_id
forv i = 1/`_N'{
if crosssection_id[`i']==crosssection[`i'-1] & year[`i']==year[`i'-1]
& year_id[`i']!=year_id[`i'-1]{
local newid=year_id[`i'-1]
local oldid=year_id[`i']
replace year_id=`newid' if year_id==`oldid'
}
}

My questions are:
Given that I've done the yearly linking as I have, is there a more
efficient method of linking these IDs?  My devised scheme I think is
correct, but takes a very long time.

Would there have been a more efficient means of linking the IDs over
time?  I didn't do it at the individual level because within a firm
the it seems less probably that two people would have the same
ethnicity, experience, etc.

Thanks for any advice!
Paul
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index