Statalist


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

st: -date- creates missing values


From   Michael McCulloch <mm@pinest.org>
To   Statalist Statalist <statalist@hsphsun2.harvard.edu>
Subject   st: -date- creates missing values
Date   Mon, 5 Oct 2009 10:24:58 -0700

Hello friends,
I recently moved a do-file from Stata 9 to 10, and the following short  
date program, instead of creating Stata dates, now creates missing  
values. It's supposed to take dates in MM/DD/YY format imported from  
an Excel .csv file, and translating them to Stata date format.

I'd appreciate any pointers/critiques on my method, or what I missed  
in the 9 to 10 upgrade...

*prep date vars, from mm/dd/yy
    foreach D of varlist d_sample1  ///
                         d_sample2 ///
                           {
      generate `D'1 = date(`D', "mdy", 2010)
      format `D'1 %d
      drop `D'
      rename `D'1 `D'
     }


Michael McCulloch, LAc MPH PhD
Pine Street Foundation
124 Pine Street
San Anselmo, CA 94960-2674
tel:	415-407-1357
fax: 	206-338-2391
mm@pinestreetfoundation.org






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