Announcement

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

  • Disabling logs when running Stata in batch mode -- Windows

    Hi All,

    I'm running Stata in Windows to run some large analyses (i.e., thousands of regressions on hundreds of thousands data points).
    I'm using batch mode and compiling the output of these analyses on custom files, thus I do not require Stata to generate a log. My main problem is that Stata writing these logs has become my main bottleneck.

    Is there a way to tell Stata to not write a log when running in batch mode? The information from the manual is not helpful in this regard (see here https://www.stata.com/manuals/gswb.pdf#gswB.5).

    I am aware I could try to alter the code I'm using to limit its output. Problem is I'm using someone else's custom functions and digging through them will take considerable time and effort, so turning off the log would be a much faster solution right now.

    Any help is appreciated.

  • #2
    I think if in your batcfh command you change -do- to -run- the log will be suppressed.

    Comment


    • #3
      Welcome to Statalist.

      I do not believe you can suppress creation of the log file, but you can use the quietly prefix to suppress output to the log file, so your log file will be empty or nearly so, which could minimize the time spent writing the logs. Note that quietly can be used as a prefix to a block of code.
      Code:
      quietly {
      sysuse auto, clear
      regress price weight
      }
      display "r-squared is " e(r2)
      produces
      Code:
      . quietly {
      
      . display "r-squared is " e(r2)
      r-squared is .29010231
      
      .

      Comment


      • #4
        Red panda: Full real name please.

        Comment


        • #5
          Thank you Clyde and William!
          This is exactly what I needed. Both answers achieved the desired result, so I'm glad to know I have more than one tool in my box now

          For the record, while looking through the quietly documentation I also noticed a third option that could be of use to anyone that might need this in the future.
          Using set output error will suppress all output other than errors and warnings. The manual discourages using this option for some reason, but it is there in case it can be of use to anyone.

          Much appreciated!

          Comment

          Working...
          X