From | Clare L Maxwell <[email protected]> |
To | [email protected] |
Subject | Re: st: Lots of date vars from month, day, year vars-FU qx forEric Wruck |
Date | Sat, 12 Nov 2005 13:35:20 -0600 |
Hello, Eric. Thank you very much for thinking about this. At 2:02 PM -0500 11/12/05, Eric G. Wruck wrote:
I'm not sure I fully understand what you're looking to do (more detail would increase the likelihood that someone will be able to help you). Nevertheless, you may be interested in Stata's mdy() function.Yes, the mdy() function is what I can use on three variables at a time. The problem is that I have as many as 50 triplets of m, d, y that I would like to feed into some kind of automated routine to create 50 corresponding date vars. Calculation of dates is the simplest problem of this structure to describe, but there are others less trivial, and that is what is really holding me up.
EricI have done my best to see how foreach could be adapted to this problem. It is possible that if I understood macros better it would help. A miniature version of what I am talking about would be variables mo1, mo2, day1, day2, yr1, yr2, hoping to use them to calculate dt1, dt2, without two statements gen dt1 = mdy(mo1,day1,yr1) and gen dt2 = mdy(mo2,day2,yr2). I'd like to be able to say something like
p.s. If you have lots of different m, d, & y variables, you may want to learn about foreach or forvalues depending on how your variables are named.
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |