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 <[email protected]>
To   [email protected]
Subject   Re: st: date command error?
Date   Tue, 15 Jan 2013 01:30:47 -0500

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
<[email protected]> 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