Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

re: st: how to generate panel ID


From   Christopher Baum <[email protected]>
To   <[email protected]>
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index