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 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]

st: RE: foreach command


From   Martien Lamers <Martien.Lamers@ugent.be>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: foreach command
Date   Tue, 23 Aug 2011 19:16:36 +0200

<>

In your loop, 'model' should be `model' and loglogisitc should be loglogistic
________________________________________
Van: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] namens Megan Osterbur [megan.osterbur@gmail.com]
Verzonden: dinsdag 23 augustus 2011 18:58
Aan: statalist@hsphsun2.harvard.edu
Onderwerp: st: foreach command

I am having a problem with the foreach command in stata10. It was not
working with my own dataset so I attempted to use the example from
Cleves et al An Inroduction to Survival Analysis Using Stata 2nd ed
and the example does not work either.

If you are unfamiliar, this example uses the hip fracture study
available from stata press.

Here are the results from the example:

 use http://www.stata-press.com/data/cggm/hip2
(hip fracture study)

. foreach model in exponential weibull gompertz lognormal loglogisitc gamma {
  2. quietly streg age protect, dist('model') noconstant
  3. estimates store 'model'
  4. }
unknown distribution: 'model'
r(198);

I get the same results with my own data:

 foreach model in exponential weibull gompertz lognormal loglogistic gamma{
  2. streg federalist al_religion fe_cultdiv fe_etfra m_wominpar
van_urban europcon e
> umem popgrowth organizations print unemployed unitary confederation rightexec centr
> istexec parliament mixedsys prelectoral  mixelect proportional mixedelectoral parmo
> narchy execmixed, dist('model') noconstant
  3. estimates store 'model'
  4. }
unknown distribution: 'model'
r(198);

*
*   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/


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