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: Foreach loop for subsequent variables


From   Dmitriy Glumov <[email protected]>
To   [email protected]
Subject   st: Foreach loop for subsequent variables
Date   Tue, 1 Nov 2011 10:44:34 -0400

Dear Statalist Users,

I have recently begun to use Stata and have run into the problem
writing a foreach loop. I have a large dataset of variables, paired in
a way that var1 and var2 are together, var3 and var4 are together, and
so on. I am writing a foreach loop for each individual odd variable
and, everytime the program loops, I need to include a subsequent even
variable as well. So, for example, given that var1 is `x', I need to
include var2 into the program, too (in essence, `x' + 1). The problem
doesn't seem to be very difficult, and I am sure there is a simple
solution to it, but I just can't find it anywhere. Thank you for your
consideration, any help would be greatly appreciated!

Dmitriy
*
*   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