Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: looping over several macros


From   John Holmes <john.holmes@sheffield.ac.uk>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: looping over several macros
Date   Tue, 15 Feb 2011 16:17:47 +0000

Hi,

I want to perform a transformation on the variable 'drating' based on
the values of three local macros as below

gen drating06 = .
replace drating06 = drating * `change' if drating >= `1994' & drating
< `1994_shift'

On the first loop, I want to use the first values in all of the macros
`change', `1994' and `1994_shift', on the second loop I want to use
the second values in all of the macros and so on.  Can somebody tell
me the right code to use so Stata loops on all three macros
simultaneously rather than looping the first, then the second and then
the third.

Thanks

John Holmes

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index