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: possible nested loop with multiple items
From
"Dr. Bill Westman" <[email protected]>
To
[email protected]
Subject
st: possible nested loop with multiple items
Date
Tue, 27 Apr 2010 15:12:39 -0700 (PDT)
This is probably quite simple, but I've tried and failed a few times to write a working loop.
What I have isthe number of observations stored in variables representing numerators and denominators of several hundred questions. The list has matched numerators and denominators, but each item has different numbers of letters (e.g.q_01a and q_01b, but q_02a-c). Also numbers skip.
q_01a_num
q_01b_num
q_02a_num-
q_02x_num
q_02a_den
q_02b_den
q_02x_den
I'd like to either loop through each item to
gen prop_`i' = q_***_num/q_***_den
or contract (if that is easier).
Any suggestions would be appreciated.
Thanks!
Bill
*
* 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/