Hi all,
I have a large set of string variables (too large to encode) that contain dates and specific times in the following manner:
09SEP19:09:00:00
I would like to convert it to dates using either
gen new_date_var = date(string_var, "DMY###")
gen new_date_var = clock(string_var, "DMY#hms")
However none of these work apparently because of the : between the Year and the Time (---19:09---) and therefore the new_date_var generates only missing values.
I also tried to use multiple # to account for the additional : but it is not working.
I would highly appreciate any help =)
Thank you for your time!
Related Posts with String to date variable with time when string does not follow the format DMY ## or DMYhms
Predicted R-squaredAnyone know of a Stata command or user-written routine that generates the predicted R-squared after …
How to deal with values that include numbers and lettersHello! I have a dataset that includes ICD10 codes, which include both numbers and letters (as seen i…
_cf mismatch on two datasets created by the same programHello, Why would it be the case that the same program (e.g. sales.do) used to generate the same dat…
The log-likelihood function of mlogit command with vce(cluster id)Hi I have a question about the mlogit command. As you know, multinomial logit model is estimated by…
Export cross tab with summary statisticsHi everyone, this seems like a super obvious question that I'm sure somebody has asked before, but …
Subscribe to:
Post Comments (Atom)
0 Response to String to date variable with time when string does not follow the format DMY ## or DMYhms
Post a Comment