Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: possible nested loop with multiple items


From   "Dr. Bill Westman" <bigweb_ddt@yahoo.com>
To   statalist@hsphsun2.harvard.edu
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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index