Hi guys,

So I'm basically making regression models for a loop of all variables and one fix variable, such as
Code:

foreach var of varlist _all { regress DependentVar IndependentVar1`var' }
I then manually look for R values above 0.9 and calculate margins for those, such as:
Code:

regress DependentVar IndependentVar1 IndependentVar2 //R=97 margins, at(IndependentVar1=(Value in Year X) IndependentVar2=(Value in Year X))
I was wondering whether I could automatize this such that it automatically enters the values for IndependentVar1 and IndependentVar2? All cases are identified by a year. Right now, this is done by hand which is quite time consuming given that the dataset has about 70 variables, and we try to do it for about 7 different parties.

Thank you for your help!

The background is that we are trying to find election predictions with fundamentals for a university class.