I have a variable in an imported dataset from Excel in this type and format:
type: double
format: %tcnn/dd/ccYY_hh:MM
Example:
DATE
4/25/2019 10:50
I need a variable with only the date 4/25/2019 (not the just the format %td, but the exact date with out time decimals such that time is removed and the date value is int)
I've tried the following:
gen newvar = dofd(date) result= 1.87e+12
gen newvar = string(date, "%td") = "1.87e+12" // in order to use e.g. date, substring or split to create a new date var.
Can someone explain what the problem is?
Kind regards,
Torben
Related Posts with Remove time in datetime variable
Help Fixing Bar Graph of GDP and Dummy VariablesDear all, I am using Stata 16, on mac. I used the following command in Stata: reg lnGDP lnagedpop l…
Stata returning missing when converting string dateDear all, I have dates in two formats in a single variable one is 20-Apr-19 the other is 21-APRIL-20…
Episode splittingHi, I am trying to split my time-varying education variable, didn't figure out something. In my data…
Trouble Generating Variable dependant on periodArray Above is a picture of a subset of my data. hs10 refers to a specific product being sold and m…
Different I-square results for meta summarize and meta forestplot using random empirical Bayes methodHi The meta forestplot using random(ebayes) appears to produce a different value for the I2 result …
Subscribe to:
Post Comments (Atom)
0 Response to Remove time in datetime variable
Post a Comment