Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | sun samn <shwshang@hotmail.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: how to generate panel ID |
Date | Fri, 8 Oct 2010 02:08:14 +0800 |
Dear Dr. Baum, Thanks for your help. You may not know that your online lecture notes help me a lot! Thanks again, samn > From: kit.baum@bc.edu > Subject: re: st: how to generate panel ID > Date: Mon, 4 Oct 2010 21:59:13 -0400 > To: statalist@hsphsun2.harvard.edu > > <> > I have a data set, which has criminal rates of 50 cities for two years. It is a nice panel data setting, but there is no panel ID. I just realize that it is hard to generate it in STATA. > I have the 'year' variable, which is either 1987 or 1990. > Could you someone help me with this? > > If you have the city name as a string variable, > > encode cityname, gen(icty) > tsset icty year, delta(3) > > If you don't have such a variable, but you are certain that the 50 cities for 1987 are in the same order as they are in 1990, > > by year: g icty = _n > tsset icty year, delta(3) > > Kit > > Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html > An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html > An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html > > > * > * 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/ * * 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/