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
Combining multi-item measuresHello, I have 10 variables that all measure how much an individual compares himself to society on a…
Propensity score matching and outcome variableDear all, I am trying to create a control group using Propensity score matching. The idea is to sel…
Tabulating and dropping grouped dataHi, I have a dataset based on a survey where each individual is given a unique id and has several r…
Combining meglm and svy: error messageOur goal is to build a three-level hierarchical linear model based on complex survey design in Stata…
2x7 table differencesSo I have 2 independent variables and 1 dependent category with 7 variables. Fishers exact tells me …
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment