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 on April 23, and its replacement, 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 <>
To   <>
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–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index