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   Ketan Patel <>
Subject   Re: st: problem with do file stopping prematurely
Date   Fri, 4 Nov 2005 15:47:07 -0500

Hi Christopher,

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.

--Ketan Patel

On 11/4/05, Christopher W. Ryan <> wrote:
> I composed the following do file in Crimson editor:
> *reverse code the appropriate items in pms
> vreverse pms3, gen(pms3r)
> vreverse pms5, gen(pms5r)
> vreverse pms6, gen(pms6r)
> vreverse pms8, gen(pms8r)
> vreverse pms9, gen(pms9r)
> vreverse pms11, gen(pms11r)
> vreverse pms12, gen(pms12r)
> vreverse pms13, gen(pms13r)
> vreverse pms14, gen(pms14r)
> vreverse pms22, gen(pms22r)
> vreverse pms23, gen(pms23r)
> vreverse pms24, gen(pms24r)
> *recode appropriate items in diri
> vreverse diri3, gen(diri3r)
> vreverse diri4, gen(diri4r)
> vreverse diri7, gen(diri7r)
> vreverse diri12, gen(diri12r)
> vreverse diri13, gen(diri13r)
> vreverse diri14, gen(diri14r)
> vreverse diri15, gen(diri15r)
> vreverse diri18, gen(diri18r)
> vreverse diri19, gen(diri19r)
> *now summate the rating scales
> gen
> pmsscore=pms1+pms2+pms3r+pms4+pms5r+pms6r+pms7+pms8r+pms9r+pms10+pms11r+pms12r+pms13r+pms14r+pms15+pms16+pms17+pms18+pms19+pms20+pms21+pms22r+pms23r+pms24r+pms25
> gen
> diriscore=diri1+diri2+diri3r+diri4r+diri5+diri6+diri7r+diri8+diri9+diri10+diri11+diri12r+diri13r+diri14r+diri15r+diri16+diri17+diri18r+diri19r+diri20+diri21+diri22+diri23+diri24+diri25+diri26+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.
> I am puzzled, as usual.
> Any suggestions?
> Thanks.
> --
> Christopher W. Ryan, MD
> SUNY Upstate Medical University Clinical Campus at Binghamton
> and Wilson Family Practice Residency, Johnson City, NY
> cryanatbinghamtondotedu
> GnuPG and PGP public keys available at
> "If you want to build a ship, don't drum up the men to gather wood,
> divide the work and give orders. Instead, teach them to yearn for the
> vast and endless sea."  [Antoine de St. Exupery]
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index