logout -- Converts log or ASCII files into various output formats
logout, [options : command]
logout provides a fast and easy way to convert log or ASCII files into various output formats compatible with Word, Excel, LaTex, or Stata datafile. Can be used as a prefix or by itself after a log file has been created.
More specifically, logout will import plain-text files into tab-delimited format, which is then converted into the output format of choice. The default method is tab/space-delimited, along with a list of usual suspects. Alternatively, infix method can be used when the column position is meaningful.
Can also be used to chew through dirty files such as html, etc. Will also chew through any ASCII log files, including those produced SAS, SPSS, etc. In Stata, you can use caplog to create log files on the fly.
table and tabstat are automatically handled by fix method.
Any command accepted, i.e. estimation commands, tabulation, summary, descrition, etc.
+------+ ----+ Main +-------------------------------------------------------------
clear Replace the current data in memory, then manipulate the file as a Stata data.
save( ) The name of output file. logout.txt is assigned if clear or temporary file is not used.
use( ) The name of input file to be converted.
raw Raw file is diplayed in the first column (up to 244 character limit).
fix Use automatic fixed method (i.e. infix) to read the file.
fix(#) Adjust the sensitivity of fix method. Default is 5. Try 1 for narrower parsings.
fixcut(# # ...) Use manual fixed method (i.e. infix) to read the file. Something like fixcut(3 5 10 15). Drop a number if you want to merge columns there. A suggestion is displayed whenever fixed method is run
auto( ) The number of automatically formatted decimals to be reported. Default is 3.
noauto Turns off the automatic formatting of decimals.
dec( ) Fixed number of decimals. Turns off automatic formating.
word Convert into Word compatible file.
excel Convert into Excel compatible file.
tex Convert into Latex or tex compatible file.
dta Convert into .dta file for Stata.
nowipe Do not apply minimal cleaning, which are:
.drop if t1=="-----" | t1=="opened" | t1=="log" | t1=="." | t1=="closed"
* summary sysuse auto, clear logout, save(myfile) excel replace: sum
* summary, MANUALLY clean it sysuse auto, clear logout, clear: sum drop t2 t5 t6 logout, save(myfile) excel replace
* summary, detail sysuse auto, clear logout, save(mystuff) excel word replace: sum, detail
* one-way tabulation with value labels sysuse auto, clear logout, clear excel dta tex save(myfile) replace: tab foreign rep78
* one-way tabulation sysuse auto, clear caplog using mystuff.txt, replace: tabulate price [aweight=turn], summarize(headroom) logout, use(mystuff.txt) save(mytable) clear excel tex dta replace
* two-way tabulation sysuse auto, clear logout, clear: tab mpg foreign logout, save(mytable) clear excel tex dta replace
* table, combined it with -fix- method sysuse auto, clear logout, save(mystuff) excel fix replace: table trunk rep78, c(n mpg mean mpg sd mpg median mpg) stubwidth(25)
* table, MANUALLY clean it after using -fix- or -fix(1)- sysuse auto, clear caplog using mystuff.txt, replace: table trunk rep78 , c(n mpg mean mpg sd mpg median mpg) logout, use(mystuff.txt) fix(1) replace clear drop in 1/2 logout, save(mystuff.txt) excel replace clear
* regress sysuse auto, clear logout, save(myfile) excel dec(3) replace: reg price mpg rep78 headroom
* tabstat sysuse auto, clear logout, save(mytable) excel replace: tabstat price mpg rep78, stats( max p1 mean)
* The following three are more or less equivalent: webuse dose, clear caplog using mylog.txt, replace: tab dose function, col chewfile using mylog.txt, begin(10) end(.) save(chewed.txt) replace logout, use(chewed.txt) clear fix logout, save(C:\mytable) tex excel replace
logout, save(C:\mytable) tex excel replace range(10/.) fix: tab dose function, col
logout, save(C:\mytable) tex excel replace range(10/.) fixcut(11 16 27 38 45 50 67): tab dose function, col
** Merging two columns by skipping a fixcut number: logout, save(C:\mytable) tex excel replace range(10/.) fixcut(11 27 38 45 50 67): tab dose function, col
The default is space/tab-delimited. For semi-ordered file, try using fix and values less than 5 for fix( ).
"Detailed" suggestions should be sent to the email address below. fix erases rows with many dashes as a horizontal line May not handle an exceptionally large log file. Small Stata may have a problem with the column limits. ASCII character "_" is used to handle space delimited value labels. version 7: do not include colon characters (:) in the file path. Use cd instead. version 7: range( ) option not available.
The codes for word and tex are traced back to John Gallup's outreg through outreg2. excel is implemented as a facsimile of xmlsave. Value labels are handled as proposed by Karl Keesman at email@example.com
Roy Wada firstname.lastname@example.org