Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Stata programming: While Command


From   "Leonor Saravia" <[email protected]>
To   [email protected]
Subject   st: Stata programming: While Command
Date   Mon, 3 Mar 2008 09:33:33 -0300

Dear Statalisters,

I'm learning how to make some programs in Stata, but I�m having
problems in using the 'while' command.

My database looks like this:

FIRM_ID         IND1   IND2    IND3 .....IND9   TAX      INV
120                  1        0         0          0         0.16     100
123                  0       1          0          0        0.16      200
120                  1        0         0          0         0.15     150
134                  0        0         0          1         0.16     180
123                  0        1         0          0         0.15     200
134                  0        0         0          1         0.15     120
.
.
123                  0        1         0          0         0.17     130

I need to do a two step regression by the variable IND, this is:  when
IND1==1, IND2==1, IND3==1, ...,IND9==1, I need that Stata runs this
programm:
                                                         First step:
regress TAX EXP, robust

   predict tax_hat
                                                         Second step:
xtreg INV tax_hat, fe
                                                                           end

So, what I was trying to do in my do-file was (and it's not working):

local industria "ind1 ind2 ind3 ind4 ind5 ind6 ind7 ind8 ind9"

while `industria' == 1 {

reg tax exp, robust

predict double tax_hat

xtreg ln_inv tax_hat, fe vce(bootstrap)

drop tax_hat

}

But when I do this, Stata gives me this message:     program error:
code follows on the same line as open brace

I don�t understand what�s the problem so I'd appreciate your help very much.

Thanks,

Leonor

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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