Statalist


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

st: resend


From   "Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: resend
Date   Thu, 13 Nov 2008 14:23:36 -0800

I sent this earlier today, but it didn't appear on the list.  Let's try
again - sometimes my posts don't appear.

I converted an Excel spreadsheet using StatTransfer and all of the
variables came through as strings.  I converted a date variable using
the command 
gen daten=date(date,"MDY") 
and about half of the dates came through just fine.  However, some dates
did not convert:
      ----------------------|
131. | 10/10/1986      9779 |
132. | 03/21/1995     12863 |
133. | 09/26/1995     13052 |
134. | 04/03/1996     13242 |
135. |                    . |
     |----------------------|
136. |   09/15/90         . |
137. |   03/15/91         . |
138. |   12/15/98         . |
139. |   07/15/86         . |
140. |   02/15/87         . |
     |----------------------|

The left column is the string variable, the right column is the julian
date (I later convert to a date format, and the ones that do convert are
correct).
I thought the problem might be extra spaces, so I tried ltrim and rtrim
to get rid of them, but it didn't work.
I suspect others may have seen this problem - it's a pain in the neck to
do the conversion, but I did it manually.  
Does anyone have an idea what might be happening?

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001



*
*   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   |   What's new   |   Site index