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: loop in stata


From   fernando andrade <[email protected]>
To   statalist <[email protected]>
Subject   st: loop in stata
Date   Thu, 11 Aug 2011 15:06:20 -0400

Hello
I am trying to make a simple loop in stata but i cannot figure out how to.
i have two sets of variables let's say:
set1: a b c ...m
set2: z y x...n

i want to make a loop to run the tabs
tab a z
tab b y
tab c x
.
.
.
tab m n

i tried
foreach X in a b c... m{
foreach Y in z y x... n{
tab `X' `Y',m
}
}

the loop gave me all the posible combinatios between the two sets of
variables. Is there a way to make a loop that tabs only a with z, b
with y and so on
thank you.
Fernando
*
*   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