Statalist


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

st: Re: date format


From   Alexandra Griffiths <aegriffiths@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: date format
Date   Thu, 25 Oct 2007 15:33:30 +0100

Dan,

Just use:

gen datenew=date( dateold, "YMD")
format datenew %td

If your date variable is not a string variable then run this (below) first to convert it to a string:

tostring datesold, replace

Hope this helps,

Alex

Rodriguez, Dan (Prop) wrote:

Need to convert date format of YYYYMMDD into Stata date format. Does anyone have a short do-file to accomplish this?

Thank you,
Dan
*
*   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