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: converting varying formats of string dates into Stata dates


From   "Kate Rohrbaugh" <krohrbaugh@ipaglobal.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: converting varying formats of string dates into Stata dates
Date   Thu, 29 Jul 2010 10:22:02 -0400

Greetings Statalist:
 
First, I hope my attempts at removing the HTML text were successful.  If not, apologies in advance.

Second I have several fields that have dates in all sorts of manner, for example (and there are more types, like mar-01-2000, this is just a smattering):

. l2 todate1 in 1/20

  +-----------+
  |   todate1 |
  |-----------|
  | 30-Jun-99 |
  |  10/15/99 |
  | 4/15/1998 |
  | 4/15/1998 |
  | 8/15/1998 |
  |-----------|
  |   3/15/00 |
  |  6/1/1998 |
  |  6/1/1998 |
  |  1-MAR-00 |
  |  1-MAR-00 |
  |-----------|
  |  1-MAR-00 |
  |  1-MAR-00 |
  |  02/15/98 |
  |  12/01/98 |
  |  1-AUG-00 |
  |-----------|
  | 8/15/1998 |
  | 8/15/1998 |
  | 6/30/1998 |
  | 6/30/1998 |
  |  7/1/1999 |
  +-----------+

Is there an ado-file or function out there that can help fix this?  We have something called chgdate, but it assumes that all the variables are in "xx/xx/xxxx" format and drops everything else.  My goal is to have 1 variable that has a date in the Stata date format.

Thank you!

Kate




Kate Rohrbaugh
Research Team Leader
Research and Special Studies
Independent Project Analysis, Inc.
44426 Atwater Drive
Ashburn, VA  20147
 
direct - 703.726.5465
front desk - 703.729.8300
fax - 703.729.8301
email - krohrbaugh@ipaglobal.com
website - www.ipaglobal.com



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