Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Executing do-file yields no output |
Date | Mon, 9 May 2011 12:56:02 +0100 |
I don't understand what you are reporting. I'd get in touch with Stata technical support. Nick On Mon, May 9, 2011 at 12:50 PM, George Mailbox <george.mailbox@gmail.com> wrote: > Nick, Neil, > > I used the command "do dofilename" and I expected the command window > and the log-file to display the commands, regression estimates and > post-estimation test results. However, they only display the commands > exactly the way they are in the do-file, each line preceded by ">", > yet no regression estimates and no post-estimation test results. It > looks like stata is just going through the commands but not executing > them. I tried including an error to test whether it spots it and it > did! > > "dir" tells me that the do file and the data file are in the same directory. > > The do-file (98KB) is structured as follows: > > ############################## > > clear all > > capture log close > > set more off > > version 10.1 > > use filename.dta > > log using filename.log, text replace > > command1 > > command2 > > . > . > . > > log close > > set more off > > exit > ############################## > > The only solution I could come up with would be stripping my do-file > of all comments and running it through the command window by copying > and pasting chunks. This defeats the purpose of a do-file though. > > It's a puzzling problem I have been spending days researching online, > even my colleagues in the office hadn't seen Stata handling a do-file > in such a strange way. > > George > > > > > > > > 2011/5/9 Nick Cox <njcoxstata@gmail.com>: >> My apologies: it's the other way round. (Possibly insufficient >> caffeine on my part this morning.) >> >> If your do-file includes a -regress- command, you should see the >> results with -do-, but not with -run-. >> >> >> On Mon, May 9, 2011 at 12:11 PM, George Mailbox >> <george.mailbox@gmail.com> wrote: >>> Nick, >>> >>> Many thanks for getting back. >>> >>> You mentioned "do" is silent, with online sources suggesting "run" >>> suppresses the output, for instance: >>> >>> do filename [arguments] , [nostop] >>> Executes the specified do-file. >>> nostop allows to continue execution even if an error occurs. >>> On-line, context: 1, 2 >>> >>> run filename [arguments] , [nostop] >>> Executes the specified do-file suppressing the output, except for erors. >>> nostop allows to continue execution even if an error occurs. >>> On-line, context >>> >>> (Source: http://web.missouri.edu/~kolenikovs/stata/Duke/commands.html#) >>> >>> Further, it appears that the terms "do" and "run" are often used >>> interchangeably as in "run a do file using the do command" which >>> complicates matters for beginners. >>> >>> My question thus boils down to: >>> How can I execute my do-file such that Stata displays the regression >>> estimates in the command window and the log-file? >>> >>> Best wishes, >>> George Hylden >>> >>> >>> >>> >>> >>> >>> 2011/5/9 Nick Cox <njcoxstata@gmail.com>: >>>> This is precisely as intended. -do- rather than -run- is silent. What >>>> output would you expect from these commands if they work as intended, >>>> i.e. with generating error messages? >>>> >>>> Nick >>>> >>>> Please note the request to use real names on Statalist. >>>> http://www.stata.com/support/faqs/res/statalist.html#tojoin >>>> >>>> On Mon, May 9, 2011 at 10:18 AM, George Mailbox <george.mailbox@gmail.com> >>>> >>>>> When I execute a do file (i.e. do do-file as opposed to run do-file), >>>>> Stata (version 10.1) loads the data and runs through all commands >>>>> without detecting errors but only displays the do-file commands >>>>> preceded by ">", i.e. it does not display the results in the command >>>>> window and thus not in the log-file either. When I copy and paste the >>>>> commands into the command window, then Stata displays the results, >>>>> i.e. the code is correct. >>>>> I suspected some "suppress output" function was activated but I >>>>> haven't been able to find any such thing. >>>>> >>>>> The do-file is a self-written plain do-file, not code written in a program. >>>>> The procedural commands that precede the data manipulation commands >>>>> are standard by my reckoning: >>>>> >>>>> ############################## >>>>> >>>>> clear all >>>>> >>>>> capture log close >>>>> >>>>> set more off >>>>> >>>>> version 10.1 >>>>> >>>>> use filename.dta >>>>> >>>>> log using filename.log, text replace >>>>> ############################## >>>>> >>>>> I would be grateful for any advice or suggestions. * * 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/