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]

re: st: how to generate panel ID


From   Christopher Baum <kit.baum@bc.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   re: st: how to generate panel ID
Date   Mon, 4 Oct 2010 21:59:13 -0400

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index