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   "Rodrigo A. Alfaro" <[email protected]>
To   <[email protected]>
Subject   Re: st: RE: Pgm 2 remove grammatical errors in log
Date   Wed, 10 May 2006 18:09:11 -0400

Hi,

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/



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