Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: Pgm 2 remove grammatical errors in log


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Pgm 2 remove grammatical errors in log
Date   Wed, 10 May 2006 23:55:36 +0100

For "Marteen" read "Maarten", passim... 

More seriously, I think this is the pivot 
on which this thread will turn and turn. 

Frankly, "fix the log to what it would have
been had I been as smart about the problem 
as I am now" is a task requiring human 
awareness and decisions. I doubt that it can 
be automated completely. 

Or, if you are smart enough to program this, 
you have already learnt a better way to 
tackle the problem than to program this. 

To echo Phil Schumm who echoed me, 
this is a task made easier by scripting languages
or good text editors. 

Talking of which, my favorite text editor, Vim, 
just got a lot better with Vim 7.0. And -- 
excellent news -- syntax files for not only 
.ado and .do files but also SMCL files and 
.class files by Jeff Pitblado of StataCorp are 
bundled with the official release. They're
very good! 

See http://www.vim.org if you use Vi or Vim. 

(If you don't, learning Vi[m] is not compatible 
with imminent births, marriages or thesis
submissions but long haul, it can repay the 
effort well.) 

Nick 
[email protected] 

Rodrigo A. Alfaro
 
> Uff, sorry Marteen for changing your name.
> 
> Note that in the Marteen's program (valid) the line is 
> executed only if 
> there is not error. So there will be no-garbage in the 
> log-file. If the next 
> line is "independent" of the previous results then my program 
> will be fine. 
> I think this was the original request of Robert. Indeed, he 
> wrote "... that 
> passes through the smcl file, finds the errors, makes a 
> record of what line 
> they are on, and then on a second pass erases the command 
> generating the 
> error and the error"
> 
> But if the line are not independent then Nick's comment is 
> right and I think 
> the problem is very hard to solve. Indeed, it is some kind of 
> "debugging" 
> program, right? Maybe you can put the -capture- results in a 
> matrix and 
> check there what numbers of commands are not working. After 
> pass all-lines 
> you care about log-file.
> 
> Rodrigo.
> 
> 
> ----- Original Message ----- 
> From: "Nick Cox" <[email protected]>
> To: <[email protected]>
> Sent: Wednesday, May 10, 2006 6:14 PM
> Subject: RE: st: RE: Pgm 2 remove grammatical errors in log
> 
> 
> How does this approach cope with the problem
> that if one command is invalid, then many
> -- perhaps all -- subsequent commands won't work either?
> 
> For "Martin" read "Maarten", passim.
> 
> Nick
> [email protected]
> 
> Rodrigo A. Alfaro
> 
> > I understand the program that Robert wants. But Martin's
> > solution can be
> > implemented in a do-file framework as the following example.
> >
> > program clean
> >     log using output, smcl replace
> >     sysuse auto
> >     valid reg price mpg
> >     valid reg price mp3
> >     log close
> > end
> >
> > program valid
> >     capture `0'
> >     if !_rc `0'
> > end
> >
> > The program clean has all your commands and put the results
> > in a log file. I
> > added Martin's program at the bottom of the file, in other
> > words the do-file
> > contains both programs (clean and valid). Then you have to type (the
> > usual) -do clean- to load both programs and -clean- to run
> > your routine.
> >
> > The output looks "clean" for me. Is this useful for you Robert?
> > Rodrigo.
> >
> > ----- Original Message ----- 
> > From: "Robert A Yaffee" <[email protected]>
> > To: <[email protected]>
> > Sent: Wednesday, May 10, 2006 5:24 PM
> > Subject: Re: st: RE: Pgm 2 remove grammatical errors in log
> >
> >
> > Martin,
> >   Your program seems to check for errors while your running
> > the program.
> >  But it leaves all of the trace material in the log.  I'm
> > looking for a
> > program that
> > passes through the smcl file, finds the errors, makes a
> > record of what line
> > they are on, and then on a second pass erases the command
> > generating the
> > error
> > and the error, to clean up the smcl file preparatory for a
> > double check
> > of the syntax.
> >   If you know of such a program, it would be helpful to
> > get ahold of it.
> >    - Regards,
> >        Bob
> >
> > Robert A. Yaffee, Ph.D.
> > Research Professor
> > Shirley M. Ehrenkranz
> > School of Social Work
> > New York University
> >
> > home address:
> > Apt 19-W
> > 2100 Linwood Ave.
> > Fort Lee, NJ
> > 07024-3171
> > Phone: 201-242-3824
> > Fax: 201-242-3825
> > [email protected]
> >
> > ----- Original Message -----
> > From: Maarten Buis <[email protected]>
> > Date: Wednesday, May 10, 2006 5:05 pm
> > Subject: st: RE: Pgm 2 remove grammatical errors in log
> >
> > > ----Robert A Yaffee wrote:
> > > > Does anyone know of a Stata do-file or ado-file program
> > that will go
> > > > through your log file, find the syntactical errors, and
> > remove those
> > > > errors along with the commands that generated them, leaving a
> > > > syntactically perfect output?
> > > > Once such garbage is removed, it's easier to check over the
> > > output for
> > > > other errors.
> > >
> > > Bob:
> > > It is not exactly what you are looking for and if your programs
> > > take long
> > > to run than this is not very efficient but something like this may
> > > help:
> > > *-----------begin example------------
> > > program valid
> > > capture `0'
> > > if !_rc `0'
> > > end
> > >
> > > sysuse auto
> > > set trace on
> > > valid reg bla blub
> > > valid reg price mpg foreign
> > > *-----------end example-------------
> > >
> > > HTH,
> > > Maarten
> > >
> > > -----------------------------------------
> > > Maarten L. Buis
> > > Department of Social Research Methodology
> > > Vrije Universiteit Amsterdam
> > > Boelelaan 1081
> > > 1081 HV Amsterdam
> > > The Netherlands
> > >
> > > visiting adress:
> > > Buitenveldertselaan 3 (Metropolitan), room Z214
> > >
> > > +31 20 5986715
> > >
> > > http://home.fsw.vu.nl/m.buis/
> > > -----------------------------------------
> > >
> > >
> > >
> > > *
> > > *   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/
> > >
> > *
> > *   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/
> > *
> > *   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/
> >
> 
> *
> *   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/
> *
> *   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/
> 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index