< >
Jared said
Let me rephrase then. Say my date is numerical, and indicates year and
month in the form yyyymo. Then the last two digits of this number
ranges from 1 to 12. This causes the tsset to choke. That's when I use
my trick. Sorry for the confusion.
-tsset- will not choke if presented with valid input:
. l
+--------+
| var1 |
|--------|
1. | 200801 |
2. | 200802 |
3. | 200803 |
4. | 200805 |
5. | 200812 |
+--------+
. g date = ym(int(var1/100),var1-100*int(var1/100))
. format date %tm
. l
+------------------+
| var1 date |
|------------------|
1. | 200801 2008m1 |
2. | 200802 2008m2 |
3. | 200803 2008m3 |
4. | 200805 2008m5 |
5. | 200812 2008m12 |
+------------------+
. tsset date
time variable: date, 2008m1 to 2008m12, but with gaps
delta: 1 month
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
*
* 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/