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: using a loop to run multiple regression models

From   Maria Ana Vitorino <>
To   <>
Subject   st: using a loop to run multiple regression models
Date   Sat, 5 Nov 2011 13:47:10 -0400

Dear statalist users,
Can something similar to this be done in stata? The code I'm providing is *clearly incorrect* but I think it gives the idea of what I'm looking for. I'm basically trying to create sets of right-hand sets variables that can be used to generate several model specifications. And can I also include a counter in the loop that keeps track of how many different model specifications were estimated so that I can generate fitted values using the counter value as an index?

local rhssets ` "x1 x2" "x2 x3 "'
foreach rhs of loc rhssets{
corr `rhs'
reg Y `rhs'
predict yhat`counter'

Any help is appreciated.
*   For searches and help try:

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