Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Stata programming question |

Date |
Wed, 17 Feb 2010 23:47:25 +0100 |

<> Change the -varlist- in the last loop according to your taste and needs: ******* clear* set obs 1000 //get date foreach var of newlist dep1-dep44{ gen byte `var'=runiform()<.4 } //covariates gen cov1=rnormal() gen cov2=rnormal(2,4) //get reg and preds foreach var of varlist dep1-dep44{ logit `var' cov? predict p_`var' } ******* HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Data Analytics Corp. Sent: Mittwoch, 17. Februar 2010 23:17 To: statalist@hsphsun2.harvard.edu Subject: st: Stata programming question Hi, 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. Thanks, Walt -- ________________________ Walter R. Paczkowski, Ph.D. Data Analytics Corp. 44 Hamilton Lane Plainsboro, NJ 08536 ________________________ (V) 609-936-8999 (F) 609-936-3733 walt@dataanalyticscorp.com www.dataanalyticscorp.com * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Stata programming question***From:*"Data Analytics Corp." <walt@dataanalyticscorp.com>

- Prev by Date:
**st: Stata programming question** - Next by Date:
**Re: st: Stata programming question** - Previous by thread:
**st: Stata programming question** - Next by thread:
**Re: st: Stata programming question** - Index(es):