Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can I control the location of log file in batch mode?

    Let's take my real code into consideration:
    Code:
    [root@www home]#/usr/local/stata14/stata-mp -e do /home/combine1.do "$now" "$now2"
    The log file will be located on /home directory and be named /home/combine1.log
    Code:
    [root@www ~]# /usr/local/stata14/stata-mp -e do /home/combine1.do "$now" "$now2"
    The log file will be located on /root directory and be named /root/combine1.log

    Obviously, it'd better to be independent from where I execute the batch command in order to make the code "portable".

    And how do I avoid overriding the log file? (If executing it multiple time)

    Another one: since do file invoke ado file, how to record the ado file's log inside do file?

    Please give some general guidance on log issue in batch mode.
    Thanks a lot!!

  • #2
    1) Log file is created in the current directory (at least in Windows). If you want it in a specific directory, cd to that directory before running Stata, and provide full file names for both Stata executable and the do file you are running.

    See method 2 here: http://www.stata.com/support/faqs/windows/batch-mode/

    2) From Stata's help:
    log allows you to make a full record of your Stata session. A log is a file containing what you type and Stata’s output. You may start multiple log files at the same time, and you may refer to them with a logname. If you do not specify a logname, Stata will use the name <unnamed>.

    Best, Sergiy

    PS: for a long time I haven't heard of a convincing reason to use batch mode over just running Stata with a do file argument. Check if it is necessary in your case.

    Comment


    • #3
      I use cronjob to execute Stata do file on condition that all the input file/argument of do file have been prepared by other program.

      Comment

      Working...
      X