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
Asdoc mixed regression || inclusion not workingHi everyone. I'm trying to export the results of my mixed methods ordered regression using the asdoc…
Replacing string values with numerical valuesHi everyone, I'm working on a project using multiple tennis data sets (initially csv files, using a…
How to remove last 3 digits from a numerical variable in STATAHello Everyone! I have a variable HHPBASE, from which I need to chop off last 3 digits, How do I do …
Absent confidence intervals when using twoway lfitciHello, I'm generating some graphs for data illustration purposes. As a brief background, the projec…
Predicting values using Simple Linear Regression on Categorical DataHi everyone, I have student scores for two test components (Component1 & Component2) from 485 s…
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment