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
How to convert daily data to yearly dataHi, I am currently having daily data and I would like to convert it to yearly data. Ultimately, I wo…
converting string variables to numericI have a string variable that I want to change to numeric but I can't. Can you help me please stora…
Descriptive statistics tableI'm looking to create a descriptive statistics table, grouped by experimental condition. The table w…
Graph with a binomial category. Example in post!Good afternoon! https://cdn.jamanetwork.com/ama/cont...5G5CRDK6RD3PGA If I wanted to make a gra…
Curious histogram glitch?Array I can't find this reported before, and I am pretty sure it's NOT my data. Array Above, the re…
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment