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 on April 23, and its replacement, is already up and running.

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

st: Loop question

From   Nikolaos Pandis <>
To   "" <>
Subject   st: Loop question
Date   Fri, 8 Feb 2013 21:54:35 -0800 (PST)

Hi to all,

I am trying to do the following in Stata 12.1:

 foreach myvarpre of varlist pre_icw pre_imp1w pre_ipm2w pre_imw {
     foreach myvarpost of varlist post_icw post_ipm1w post_ipm2w post_imw {
         reg `myvarpost' i.appliance `myvarpre', noheader
How can I restrict in the regression and adjust only for the corresponding pre_* variable and not for all the variables in my list?

I would like only to get only the following:

reg post_icw i.appliance pre_icw
reg post_imp1w i.appliance pre_imp1w
reg post_imp2w i.appliance pre_imp2w
reg post_imw i.appliance pre_imw

Thank you


*   For searches and help try:

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