Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Stata programming question

From   "E. Paul Wileyto" <>
Subject   Re: st: Stata programming question
Date   Wed, 17 Feb 2010 21:13:04 -0500

Try this:

foreach x of varlist [list of variables]  {

logistic `x' [predictor vars]
predict p_`x'


Data Analytics Corp. wrote:

I have a simple programming problem, and since I'm not familiar with Stata programming I need some help.

I have to do 44 logit regressions and predictions where the only thing that changes from regression to regression is the dependent variable. Each regression uses a subset of the data. At the end of each regression, I predict the dependent variable for the remaining portion of the data, saving the prediction as p_dependentVariableName. I'd like to create a loop where the dependent variable will change in each pass through the loop and that variable name will be attached to p_ for the prediction.

How can I do this?  Any help is appreciated.



*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index