I am trying to shorten the following expression in Stata:
gen total = ((a1 * b1 * 365.24) + (a2 * b2 * 365.24) + ... + (a14 *
b14 * 365.24)) / (z * 365.24)
Where a1-a14, b1-b14, z are all continuous variables.
Typing the expression in full is time consuming. I seem to recall I
should be using a loop with a counter to cycle through every value 1-14.
However, I am not sure how to do that.
Thanks.
--
Thomas Speidel
*
* 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/