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

st: Declaring Time Series Problems


From   [email protected]
To   STATA list <[email protected]>
Subject   st: Declaring Time Series Problems
Date   Fri, 21 May 2004 15:55:47 -0500

I am having a lot of difficulty declaring my monthly dataset to be time series
(specifically a panel).  I also have an annual time series that I declared
without a problem.  

The annual data looks something like this
countrycode  year
1                 1960
1                 1961
1                 1962
2                  1960 
2                  1961
2                  1962 etc...

So:
tsset countrycode year, yearly

and it worked fine

But my monthly data:
c_code  year
1                 1960.01
1                 1960.02
1                 1960.03
2                  1960.01 
2                  1960.02
2                  1960.03 etc...

I have been able to convert it to string , take a substring and create a
variable called paneldate by doing the following:
generate year = real(substr(date,1,4))
generate month = real(substr(date,6,2))
generate paneldate = ym(year,month)
format paneldate %tm


So my data now looks like this:
c_code    paneldate
1           1960m1 
1           1960m2
1           1960m3
2           1960m1
2            1960m2
2            1960m3 etc..  (It shows up in the editor as 1960m1, but its value
is 0)

When I try to:
tsset c_code paneldate, monthly

I continue getting an error message saying "repeated time values within panel". 
I can't seem to figure this out.  Other than the fact that it is monthly data,
it looks exactly like my annual data that was successful.

Any help would be appreciated,
Justin


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