Zhiqiang Wang
>
> I would like to convert a long .log file into a .do file. I
> remember the
> similar question was asked on Statalist years ago but just
> cannot find it.
> Any suggestions would be appreciated very much.
I guess from this that the key task is to
extract the command lines from
among the results.
One set of suggestions for doing this kind of thing
was written up in STB-19 in 1994
in an insert "Using awk and fgrep for selective
extraction from log files".
The principle is simply to identify command
lines as lines starting with ". " or "> .".
You can also combine initial command lines with
continuation lines with some script in Awk,
Perl, Python, etc. or a decent text editor's
macro or other language. I found an Awk
script in my files. I may have the Perl
equivalent somewhere.
It is natural to wonder whether Stata
itself could be used to do this.
That is, can you read in a log file as
a string variable and process it in
some way? My guess is
that a limit on this is whether you employ
local or global macros. If you
do, then they are likely to get blanked
out as Stata will interpolate the
current value, often empty. If
you don't, then this could be the
easiest way to do it. However,
very long command lines could
easily overflow even the -str244-
limit of Stata/SE.
Nick
[email protected]
*
* 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/