Statalist


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

st: AW: -date- creates missing values


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: -date- creates missing values
Date   Mon, 5 Oct 2009 22:04:09 +0200

<> 

Have you had a look at -help whatsnew9to10-, particularly "What's new in
data management"? And try both versions of this:


*************
di date("102108", "mdy", 2010)
di date("102108", "MDY", 2010)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Michael
McCulloch
Gesendet: Montag, 5. Oktober 2009 19:25
An: Statalist Statalist
Betreff: st: -date- creates missing values

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
[email protected]






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


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index