Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re:time indicator in balanced panel


From   Christopher Baum <[email protected]>
To   [email protected]
Subject   st: Re:time indicator in balanced panel
Date   Thu, 15 May 2003 20:11:43 -0400

On Thursday, May 15, 2003, at 02:33 AM, Rajiv wrote:


I have T months of data for N firms such that there are T rows for each of
the N firms. How do I set up a simple counter in Stata to reflect time and
that varies from 1 to 12 and repeats itself for each of the N records?
Thanks!

If it is really a balanced panel:
g t=mod(_n-1,12)+1

(which will mess up if it is unbalanced)

or

by firm: g t = _n

(which will work if it is unbalanced, but not if firms' data start in different months)

Kit

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index