Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Lots of date vars, more FU qx for Eric Wruck


From   Clare L Maxwell <maxwellcl1@earthlink.net>
To   statalist@hsphsun2.harvard.edu
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:

+-----------------------------------------------------------+
| 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. }
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.

Thank you again.

Yours truly,
Clare
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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