I believe this will work, assuming the error statements and commands are not
longer than 4 lines:
infix str90 logtext 1-90 using ///
"C:\Documents and Settings\Scott_2\Desktop\log1.log", clear
gen f1 = substr(logtext,1,2)
gen byte f2= 1 if f1=="r("
replace f2 = 1 if f2[_n+3] == 1 & f1 != ""
replace f2 = 1 if f2[_n+2] == 1 & f1[_n+2] == "r("
replace f2 = 1 if f2[_n+1] == 1 & f1[_n+1] == "r("
drop if f2 == 1
drop f2 f1
outfile logtext using ///
"C:\Documents and Settings\Scott_2\Desktop\clean_log1.log", ///
replace noquote wide rjs
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Robert A Yaffee
> Sent: Wednesday, May 10, 2006 3:52 PM
> To: [email protected]
> Subject: st: Pgm 2 remove grammatical errors in log
>
>
> 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.
> Thanks in advance,
> - Bob Yaffee
>
*
* 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/