Statalist


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

[no subject]



I am not sure that I understand exactly where the difficulty is, but
if any command places a matrix into an r()-result, it is possible to
output it to, say, Excel with -xml_tab-.

If you want to mechanically dump all the results of r-class commands,
then here is how:

1. create a program Protocol.ado in your ado directory

program define Protocol

  return clear // need this in case anything is not an r-class command
  quietly `0'

  di "Saved Results:"
  di `"`:r(matrices)'"'
  di `"`:r(scalars)'"'
  di `"`:r(macros)'"'
  di `"`:r(functions)'"'

  local matrixlist `"`:r(matrices)'"'

  // Here do whatever you want with the contents, e.g. list the matrices
  foreach m of local matrixlist {
    matrix list r(`m')
  }

end


2. Open a log file

3. instead of writing "sum x" write "Protocol sum x" everywhere in your 
program

4. Close the log file

Demo:

sysuse auto
log using C:\MyLogFile.txt, text
Protocol tabstat price length weight, save
log close


Hope this is what you were looking for.

Best regards,
  Sergiy




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