Dear Colleagues
Please help: I am trying to extract the first 8 characters (NEWdate) from a date format (OLDdate) which has timestamp in it.
OLDdate's format is %tc
OLDdate
14jan2011 00:00:00
NEWdate
14jan2011
I have tried the two commands below and they dont seem to work:
gen NEWdate = substr(OLDdate, 1, 9))
format NEWdate %td
gen NEWdate = dt(OLDdate_Date, 1, 9)
format NEWdate %td
Thanks for your help.
Regards
Fadzai
Related Posts with Extracting subset date from a timestamp date variable
Outreg - varlist not allowedHello, I'm a newbie to stata. I'm doing a replication study for my school work, codes are provided a…
How to create a dbf/gal file from a dta file? (spatmat command)Hello everybody! If I have a gal/dbf file of a contiguity matrix (created through geoda, e.g.), in …
command ifgt is unrecognisedHello All. I was running some microsimulation code and got the error "command ifgt is unrecognised".…
First effects vs first differenceHello all, I am running two models with exactly the same variables (a fixed effects and a first dif…
Trend variable in a Tobit modelHello everyone, I would like to add a trend variable in my Tobit model since I was adviced not to …
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment