Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Converting string variables into date variables in STATA


From   Nikos Kakouros <[email protected]>
To   [email protected]
Subject   Re: st: Converting string variables into date variables in STATA
Date   Tue, 5 Mar 2013 08:34:05 -0500

I find these pages at UCLA very helpful
http://www.ats.ucla.edu/stat/stata/faq/string_dates.htm



On Tue, Mar 5, 2013 at 8:13 AM, Heslin, Margaret
<[email protected]> wrote:
> Thanks so much, Phil. This worked perfectly!!!
>
> Margaret.
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Phil Clayton
> Sent: 05 March 2013 12:33
> To: [email protected]
> Subject: Re: st: Converting string variables into date variables in STATA
>
> You need to specify the century. Try:
> gen DVadmission1 = date(Admission_date_1_12M, "DM20Y")
>
> Phil
>
> On 05/03/2013, at 9:31 PM, MargaretHeslin <[email protected]> wrote:
>
>> Hi all,
>>
>> I would really appreciate some help.
>>
>> I have dates in a string format as follows (dmy):
>>
>> 19.09.02
>> 01.12.09 etc
>>
>> I have tried using the following command to convert to date format but
>> the new variable comes up blank. Any suggestions as to what I am doing wrong?
>>
>> DVadmission1 is new new date variable
>> Admission_date_1_12M is the origianl string date variable
>>
>> gen DVadmission1 = date(Admission_date_1_12M, "DMY") format
>> DVadmission1 %td
>>
>> Many thanks,
>> Margaret Heslin.
>>
>>
>>
>> --
>> View this message in context:
>> http://statalist.1588530.n2.nabble.com/Converting-string-variables-int
>> o-date-variables-in-STATA-tp7580322.html
>> Sent from the Statalist mailing list archive at Nabble.com.
>> *
>> *   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/
>
>
> *
> *   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/
>
>
>
> *
> *   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/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index