I'm a relatively new Stata user with a simple question. I want to iteratively run a regression that allows a dummy variable to change value (compared to the value of a reference variable called "spread") and append some of the results of each run to a table/matrix.
This is a simplified version of what I'm trying to do (never mind what it's supposed to mean):
Forvalues i=1(0.5)5 {
gen dummy = (spread>`i')
reg y x dummy
here I want to append the value of i and the AIC to a (i,2) matrix so I can look at the results later and pick out the value of i that is min(AIC)
}
This would seem to be a simple thing, but the loop stops after the first iteration with the message "dummy already defined."
Any tips?
---------------------------------------
The information contained in this e-mail message, and any attachment thereto, is confidential and may not be disclosed without our express permission. If you are not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution or copying of this message, or any attachment thereto, in whole or in part, is strictly prohibited. If you have received this message in error, please immediately notify us by telephone, fax or e-mail and delete the message and all of its attachments. Thank you.
Every effort is made to keep our network free from viruses. You should, however, review this e-mail message, as well as any attachment thereto, for viruses. We take no responsibility and have no liability for any computer virus which may be transferred via this e-mail message.
*
* 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/