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
-mkcons- .ado to make a constantDear data cleaners I made a small program to check whether there is a constant called cons in the d…
Centering output with outreg2 commandDear Statalisters, I am using the outreg2 command to display the output from my analyses. My quest…
Data Table for GraphHi helpful folks! I've generated a histogram showing the frequency of a continuous variable using S…
Recoding variables for specific casesHi there, I need to recode variables for specific cases: I have 2 obs for each individual (Case_ID=…
Best desktop PC / configuration / charastectics for StataHi, I spend a lot of time working with Stata, handling sometimes medium to large datasets (4-100Go)…
Subscribe to:
Post Comments (Atom)
0 Response to Extracting subset date from a timestamp date variable
Post a Comment