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
mi impute chained: option savetrace() not allowed r(198)Hello, I ran the following commands to run a multiple imputation in Stata version 15.1, but ran int…
FE, RE unbalanced panel Hausman testI have an unbalanced panel data (firms' financial and ownership data of 9 years) containing some key…
Consequences of modality under 5% of the total population ?Hi everyone, I hope I'm posting this in the right place. Here is my question : I've always heard …
Importing multiple sheets from multiple excel files using loopHi everyone, I am importing 35 sheets from 35 excel files. The naming of excel sheets is such that …
Taking the difference of observations of the same variableDear all, My problem is the following: I have a panel data of EU countries in which I have many kin…
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment