Hi Martin,
Not all of your code seems to work:
This section of code works:
--------------------------------------
gen newmonths=.
tokenize `c(Months)'
forvalues i = 1/12 {
replace newmonths= `i' if Month== "``i''"
}
*Resulting in:
Month Value newmonths
January 0 1
March 4 3
April 2 4
June 3 6
------------------------------------
This section of tsfills, but the newmonths starts at month 2 instead of
month 1:
--------------------------------------------------------
tsset newmonths, monthly
tsfill
*Resulting in:
Month Value newmonths
January 0 1960m2
1960m3
March 4 1960m4
April 2 1960m5
1960m6
June 3 1960m7
--------------------------------------------------------
This section of code ends up deleting month altogether:
forvalues i = 1/12 {
replace Month= "``i''" if newmonths== `i'
}
*Results:
Month Value newmonths
0 1960m2
1960m3
4 1960m4
2 1960m5
1960m6
3 1960m7
---------------------------------------------------------------
Then, of course dropping newmonths takes away all measurement of time:
drop newmonths
*resulting in
Month Value
0
4
2
3
Thanks!
Ariel
*
* 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/