Bookmark and Share

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

[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 Baum   |   Boston College Economics & DIW Berlin   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index