Statalist


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

Re: st: problem with -IF- condition


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: problem with -IF- condition
Date   Thu, 3 Dec 2009 11:38:13 -0500

See
help ifcmd

On Thu, Dec 3, 2009 at 11:34 AM, Leila Ben Aoun <[email protected]> wrote:
> I have a huge do file to run and I try to simplify the procedure which
> is quite repetitive but I face to 2 problems quite similar.
> If you have any idea it would be welcome !
> 1-
> in my do -file I put ;
> foreach sec_var of local secteur {
>       foreach x of local it_var  {
>               xtreg `x'  `list_step1' if `sec_var'==1, re
>               test IV=0
>               local test_IV=r(p)
>       display  as result "NOT A GOOD INSTRUMENT => FIND A NEW ONE "
> if `r(p)'>0.05 and stop this part of the do-file
>       display as result  " GOOD INSTRUMENT => CONTINUE"  if `r(p)'<0.05
>               predict e_`x' , ue
>               gen var_e_`x' =e(sigma)^2
> }
> }
>
> How could I run this lines without bug because the "if" is not allowed
>

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index