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   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: date command error?
Date   Tue, 15 Jan 2013 09:29:12 +0000

For the record, note also

1. -date()- is a function, not a command. Stata is strict on the
difference: commands and functions work differently and are documented
separately.

2. The effect of -date()- with Steven's syntax and Steven's data would
be a numeric variable that is all missing. String variables can be
empty; numeric variables will be missing whenever Stata can't produce
non-missing values.

Nick

On Tue, Jan 15, 2013 at 6:33 AM, Ryan Kessler
<[email protected]> wrote:

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

>> 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

On Mon, Jan 14, 2013 at 11:19 PM, Steven Archambault
<[email protected]> wrote:

>>> 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?
*
*   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