From | Clare L Maxwell <[email protected]> |
To | [email protected] |
Subject | st: Re: Lots of date vars, more FU qx for Eric Wruck |
Date | Sat, 12 Nov 2005 17:40:36 -0600 |
Hello again, Eric. And thanks again.
No, foreach won't work that way. Here's an example using forvalues that might help:Sadly, the variables are not strictly numbered, and it would not be a good idea to rename them, especially in the other tasks I do with series of coordinated variables. In your first letter, you mentioned that people might find it easier to respond if I gave a better description of the problem. Can you think how this might be put so that old hand Stata data manipulators would know what I am talking about? Sorry that this is not exactly a statistical problem. I need to get my data into analyzable shape first, which seems to take so much more effort than one would imagine.
+-----------------------------------------------------------+
| mo1 day1 yr1 mo2 day2 yr2 mo3 day3 yr3 |
|-----------------------------------------------------------|
1. | 1 1 1960 12 25 1965 6 7 1968 |
2. | 11 12 1907 6 29 1957 3 3 2002 |
+-----------------------------------------------------------+
. forvalues i=1/3 {
2. gen date`i' = mdy(mo`i', day`i', yr`i')
3. }
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |