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

st: panel data sorting


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: panel data sorting
Date   Fri, 19 Aug 2005 06:43:56 -0400

Steve wrote
I have a large company data base in which I have the following
variables among others:  Company ID (ID), Age (age), Year (Year).

I have data from 1992-2002 and would like to keep a cohort of data for
companies that were started in 1994.  Therefore, I generated a new
variable that combines Age and Year (ageyear) to identify those
companies started in that year.  However,I cannot seem to devise a way
to keep data for those companies for subsequent years. Any help would
be appreciated!


webuse grunfeld,clear
gen int var7 = 1930 in 1
replace var7 = 1929 in 21
replace var7 = 1934 in 41
replace var7 = 1934 in 61
rename var7 yrstart
bysort company: egen start=mean(yrstart)
* I want only the histories of those companies started in 1934
keep if start==1934
tab company

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html


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