Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Issue with date function


From   "Elizabeth Allred" <lizard@hsph.harvard.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Issue with date function
Date   Mon, 07 Apr 2008 12:55:53 -0400

gen datef = date(datestr, "dm19y")

Note d m and y are lower case. Upper case does NOT work.

>>> On 4/7/2008 at 12:38 PM, in message <36739297C5CC416EA68C8F91171E6D2F@M2300>,
"Nuno" <liststata@gmail.com> wrote:
> Hi everyone,
> 
> I'm haing a problem with the date function when trying to convert a string
> variable into a date variables. My string variable is datestr and contains
> dates in the following format "31/12/94", ie, DMY. I've tried to use the
> date function using the following syntax:
> 
> gen datef = date(datestr, "DMY")
> 
> I've already used this deffinition and it worked well, but the date had the
> format "31/12/1994". Is there a way of using the date function with the
> format I'm currently using, ie, with the last two digits in year?
> 
> Best,
> 
> Nuno
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html 
> *   http://www.stata.com/support/statalist/faq 
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index