Statalist


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

st: problem with -IF- condition


From   Leila Ben Aoun <[email protected]>
To   [email protected]
Subject   st: problem with -IF- condition
Date   Thu, 3 Dec 2009 17:34:27 +0100

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



2-Secondly I have a similar trouble i have a first regression like
xtprobit Y var1 var2  var3 , re
test var3==0
xtprobit Y var1 var2  var3 , re vce(boot)  if  `r(p)'<0.05 and
continue the do file if not

*
*   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