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
Regression discontinuity of binary outcomes with rdplot/rdrobust/rdbwselect and/or rd*Hi I’m using Stata/SE 15.1 and am able to run all example do files included in the rdplot/rdrobust/r…
Crossed effects multilevel modelsHi, I collected data from an experience sampling study over 14 days, where participants belonged to…
Adding quantity of particular product from all importers and one particular exporterDear all, I have a dataset with information about products (numeric), their quantity, the importer …
Latent profile analysis with continuous indicators and local independenceHello Stata users! I am doing a Latent Profile Analysis with continuous indicators (gsem, lclass op…
change label in y-axis/x-axis?Dear All, I have the following code (please ssc install coefplot) and graph: Code: webuse grunfeld,…
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