Hi everyone,
I have a simple question: how do I convert a string variable to a date variable? The variable "date" currently contains years/quarters. Here is sample data:
1998q1
1998q2
1998q3
1998q4
1999q1
...
I tried the following:
gen date2 = date(date, "yq")
format date2 %tq
but I receive the following message: "384 missing values generated". I separately tried using "YQ", "tq", and "TQ" (instead of "yq") but this did not help.
A similar query has been raised before on these boards (http://www.statalist.org/forums/foru...-date-variable), so I think the issue has to do with the "yq".
Thanks very much for any assistance.
I have a simple question: how do I convert a string variable to a date variable? The variable "date" currently contains years/quarters. Here is sample data:
1998q1
1998q2
1998q3
1998q4
1999q1
...
I tried the following:
gen date2 = date(date, "yq")
format date2 %tq
but I receive the following message: "384 missing values generated". I separately tried using "YQ", "tq", and "TQ" (instead of "yq") but this did not help.
A similar query has been raised before on these boards (http://www.statalist.org/forums/foru...-date-variable), so I think the issue has to do with the "yq".
Thanks very much for any assistance.