Dear statalist,
I need to convert numbers to dates (format: 1/1/2019). The numbers are a string variable, and are in the following format (mdy):
datenumber
12232019
12202019
12192019
12192019
12192019
12182019
12182019
12162019
10122019
05122019
05122019
03122019
11252019
11182019
11182019
11152019
06112019
...
Notice that the months and days always exist of two digits (so sometimes it starts with a zero).
I used the code:
gen date= date(datenumber, "MDY")
But only missing values were generated. I would be very thankful if you can provide me with guidance or code to solve this issue. Eventually, I want the dates to be in the format: m/d/y: so 1/1/2019. Thank you very much in advance.
Floris Bedkom
Related Posts with converting a number to a date
Unbalanced Panel data xtlogit Hi all, I have unbalanced panel data from 2010-2017 of people who participated in a screening prog…
How to use explicit coding for multiple dummies in regression (no factor notation)Hi. I would like to run a fixed effects regression containing a continuous-categorical interaction w…
String variablesHi STATALIST, I have a string variable and detected ga68 out of it by: Code: gen ga68 = (strpos(…
Generalized Difference-in-differences with two-way fixed effect modelDear researchers, I have used the following model: Code: xtreg GG i.Event##(c.centered_Age c.cente…
Proportion confidence interval with 95% CIHow I can make a two way plot with CI. Like this graph …
Subscribe to:
Post Comments (Atom)
0 Response to converting a number to a date
Post a Comment