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]
Re: st: nested loops with varying degrees of nesting
From
David Kantor <[email protected]>
To
[email protected]
Subject
Re: st: nested loops with varying degrees of nesting
Date
Wed, 02 Oct 2013 12:56:25 -0400
At 06:33 PM 10/1/2013, Alfonso S wrote:
the simplest solution in my mind would be the following:
prog def t1
syntax , [c1 c2 c3]
if "`c1'" != "" {
forvalues d1 = 1/4 {
- do stuff -
if "`c2'" != "" {
forvalues d2 = 1/4 {
- do stuff -
if "`c3'" != "" {
forvalues d3 = 1/4 {
- do stuff -
}
}
}
}
}
}
end
Thank you, but that won't exactly do. There should be only one "do
stuff" section, in the innermost loop.
(And making that "do stuff" code handle the differing degrees of
nesting is not a problem.)
I'm not quite sure why you want to define all those local macros.
It was just a way of demonstrating the problem in generic terms.
Thanks
--David
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/