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]

AW: Antwort: st: syntax loop


From   "Lamla, Bettina" <Bettina.Lamla@rwi-essen.de>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   AW: Antwort: st: syntax loop
Date   Tue, 19 Apr 2011 11:39:53 +0200

Thanks Nick and Johannes!


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Johannes Geyer
Gesendet: Tuesday, April 19, 2011 11:35 AM
An: statalist@hsphsun2.harvard.edu
Betreff: Antwort: st: syntax loop

Hi Bettina,

"if" is not a Stata option, it has to appear before ","

forvalues i = 1/5{
 #delimit;
         qui regress indepvar depvar if _j== `i', vce(cluster respid)

 ;
 #delimit cr
 }

Syntax of regress is:

regress depvar [indepvars] [if] [in] [weight] [, options]

best,

johannes

----------------------
Johannes Geyer
Deutsches Institut für Wirtschaftsforschung (DIW Berlin)
German Institute for Economic Research
Department of Public Economics
DIW Berlin
Mohrenstraße 58
10117 Berlin
Tel: +49-30-89789-258

owner-statalist@hsphsun2.harvard.edu schrieb am 19/04/2011 11:26:26:

> Hi everyone!
>
> I have a multiply imputed data set and want to do the same
> regression for all data sets independently.
> The loop works as long as I do not add options after the regress
command.
> The error is: ?option if not allowed. ?
> Can anyone help me correct the syntax?
>
> forvalues i = 1/5{
> #delimit;
>         qui regress indepvar depvar, vce(cluster respid)
>         if _j== `i'
> ;
> #delimit cr
> }
>
>
>
> I use Stata 11.
>
> Thanks!
>
> Rheinisch-Westfälisches Institut für Wirtschaftsforschung e.V. (RWI)
> Hohenzollernstr. 1-3
> D-45128 Essen
>
> Phone: +49-201-8149-0
> Fax: +49-201-8149-200
> Web: www.rwi-essen.de
>
> Executive Board/Vorstand: Prof. Dr. Christoph M. Schmidt, (Präsident),
> Prof. Dr. Thomas K. Bauer (Vizepräsident), Prof. Dr. Wim Kösters
> Registration-No./VR 1784 beim Amtsgericht Essen
>
> *
> *   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/

Rheinisch-Westfälisches Institut für Wirtschaftsforschung e.V. (RWI)
Hohenzollernstr. 1-3
D-45128 Essen

Phone: +49-201-8149-0
Fax: +49-201-8149-200
Web: www.rwi-essen.de

Executive Board/Vorstand: Prof. Dr. Christoph M. Schmidt, (Präsident),
Prof. Dr. Thomas K. Bauer (Vizepräsident), Prof. Dr. Wim Kösters
Registration-No./VR 1784 beim Amtsgericht Essen

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