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: date command error?


From   Ryan Kessler <ryan.kessler.stata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: date command error?
Date   Tue, 15 Jan 2013 01:33:49 -0500

Oops --- wrong link. Here is the correct one -->
http://www.ats.ucla.edu/stat/stata/faq/string_dates.htm

On Tue, Jan 15, 2013 at 1:30 AM, Ryan Kessler
<ryan.kessler.stata@gmail.com> wrote:
> Hi Steve,
>
> You need to deal with your two-digit years. For example:
>
> input str25 datestr
> "01/15/96"
> "01/15/1996"
> "01/15/2013"
> "01/15/13"
> end
>
> gen dates = date(datestr, "MDY", 2013)
> format dates %td
>
> Documentation here -->
> http://www.stata.com/statalist/archive/2013-01/msg00548.html
>
> Ryan Kessler
>
> On Mon, Jan 14, 2013 at 11:19 PM, Steven Archambault
> <archstevej@gmail.com> wrote:
>> Hi all,
>>
>> I am running Stata 12 on a Mac, and am having trouble with the date command.
>>
>> My datestr values are in the format MM/DD/YY
>>
>> I am trying to convert these to a date format using
>>
>> gen dates=date(datestr, "MDY")
>>
>> dates is generated, but its an empty column. Is there something I'm missing?
>>
>> Thanks,
>> Steve
>> *
>> *   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