Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: problem with do file stopping prematurely


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: problem with do file stopping prematurely
Date   Sun, 6 Nov 2005 17:03:39 -0000

The first statement is in general quite wrong. 
However, Ketan is absolutely correct in 
advising you to check for an incomplete last 
line lacking end-of-line character(s). 

Nick 
n.j.cox@durham.ac.uk 

Ketan Patel
 
> I believe that Stata does not process the last line of a do file, so
> if the gen diriscore command is the last line of the file, it will not
> be run.  The file with just the gen diriscore command in it is
> probably not working for the same reason.  A solution is to add a
> carriage return after the end of the gen diriscore command.

Christopher W. Ryan

> > I composed the following do file in Crimson editor:
> >
> > *reverse code the appropriate items in pms
> > vreverse pms3, gen(pms3r)
> > vreverse pms5, gen(pms5r)

...

> > gen
> > 
> pmsscore=pms1+pms2+pms3r+pms4+pms5r+pms6r+pms7+pms8r+pms9r+pms
> 10+pms11r+pms12r+pms13r+pms14r+pms15+pms16+pms17+pms18+pms19+p
> ms20+pms21+pms22r+pms23r+pms24r+pms25
> >
> > gen
> > 
> diriscore=diri1+diri2+diri3r+diri4r+diri5+diri6+diri7r+diri8+d
> iri9+diri10+diri11+diri12r+diri13r+diri14r+diri15r+diri16+diri
> 17+diri18r+diri19r+diri20+diri21+diri22+diri23+diri24+diri25+d
> iri26+diri27+diri28
> >
> > The do file runs in stata as far as generating the 
> pmsscore.  Then it
> > stops with an "end of do file" message.  diriscore never 
> gets generated.
> >
> > But if I then copy and past that last command, with gen 
> diriscore= et
> > cetera, into the command window of stata, it works fine, generating
> > diriscore.
> >
> > A separate do file, containing just that last command, when 
> called after
> > the original do file is run, does nothing.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index