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
reshaping and creating unique "j()" within same idHi, I have a long-long format data set as below, I made reshaping before, but this time it is hard t…
Mata implementation of Mittag-Leffler functionI have just completed a port to Mata of Roberto Garrappa's MATLAB implementation of his algorithm fo…
Seasonal DummyDear All, I would like kindly to generate two new variables from the following data. The first var…
Multi-level model with mediator and index variable from survey-level dataHi. I am attempting to perform a regression on a combined micro (individual level data from survey …
Labeling a single observation on a scatter plot.I looking at the relation between years of education and vaccine skepticism across countries. I want…
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment