Hello everyone!
I have a dataset with monthly data. My date variable is in the format of "YM", so, e.g. "1983m1" (type = float, format =%tm)
Now, for each monthly observation, I want to create a month-of-the-year dummy for my regression.
I already tried the following code from another fellow member of the forum:
egen month =seq(), to (12)
tab month, gen(m)
Technically, this works perfectly fine. However, the problem is that sometimes, I have a month missing in my observation so that at one point, the month-of-the year dummies and my date variable are not running in sync anymore.
Is there a way that I can create my dummies directly based on my date variable? So that e.g. if my date variable jumps from "1983m1" directly to "1983m3", my month-of-the year dummy would also jump from "1" to "3" ?
Already thanks a lot for your time and support!
Related Posts with Creating month-of-the-year dummies
Merge monthly to spell dataI have two datasets, in one I have an ID and a month. The second is spell data with ID, start_date, …
Eigenvectors in Stata (mata) vs. MatlabHi everyone, maybe this is a very silly question and I am overlooking something very, very obvious. …
analysing categorical data with very high of outcome of interestHello to all. we are looking at possibilities for further analysis of knowledge of Family planning (…
Testing significance of Swamy–Arora estimator of variance component?Dear Statalisters, if I run a regression of the following form: Code: xtreg y x, re sa Is there an…
What causes the following error: data not spset r(459);copy http://www.stata-press.com/data/r15/homicide1990.dta ., replace copy http://www.stata-press.com…
Subscribe to:
Post Comments (Atom)
0 Response to Creating month-of-the-year dummies
Post a Comment