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 NEWdate
14jan2011 00:00:00 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
Regression and putexcel with parenthesesHi, I'm pretty sure I'm not the first one asking this but after a couple of hours I couldn't figure …
P value and 95%CI don't matchHello. I could like to calculate the risk difference between two groups for an outcome, using the C…
ANOVA with Holm CorrectionHi all, I’ve been asked to run an ANOVA with a Holm correction. I need to compare Stigma (continuou…
Process for LCA in StataI'm trying to do an LCA for the first time. I have read the Stata manual, various papers about LCA, …
marginal analysis after ivprobitHi all, I am using ivprobit model, and label_use is the endogenous variable. ivprobit healthy_decis…
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment