Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: dates


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: dates
Date   Thu, 6 Oct 2011 16:23:35 +0100

You don't say what "without success" means precisely. 

"200801" does not match either date pattern. If there is no information on day of month, Stata can only return missing for a daily date. 

-date("200801" + "15", "YMD")- seems to be the most common fudge. I would always tag such guessed dates with an indicator variable. 

Nick 
n.j.cox@durham.ac.uk 

Michael Eisenberg

I have a list of visit dates for patients.  Unfortunately, the format
is not constant.

Most are listed with the year, month, day such as 20080105 for Jan 5,
2008 but some are listed only with the year and month 200801 for Jan
2008.

I attempted to convert them into stata dates with the commands below
without success.

gen ndate = date(dx_date, "YMD")
or
gen ndate = date(dx_date, "CCYYNNDD")

Can stata handle such inconsistent data?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index