Hello,
I have a problem with 2 of my variables which I want to convert form string to dates. One of the variable is "admissiondate" seen below:
ADMISSIONDATE
type: string (str13)
unique values: 3287 missing "": 0/59047
examples: "16th Aug 2007"
"21st Feb 2007"
"27th Jan 2011"
"4th Apr 2007"
warning: variable has embedded blanks
My other variable is "dichordeathdate":
DISCHORDEATHDATE
type: string (str25)
unique values: 3335 missing "": 0/59047
examples: "16th Apr 2011"
"21st Aug 2011"
"27th Feb 2004"
"3rd Sep 2009"
warning: variable has embedded blanks
How can I convert them to dates?
I do not think the command """gen admdate2 = date(admissiondate, "DMY")""" works here since I do have the 4digit year but I have the rd,st,th after the day!
Is there an easy way to covert the variable to date variable without having to rewrite the whole dates?
I am working on STATA 12
Thanks,
Neo Stylianou
PhD Candidate
University of Manchester
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/