Stata 15 help for noisily

[P] quietly -- Quietly and noisily perform Stata command

Syntax

Perform command but suppress terminal output

quietly [:] command

Perform command and ensure terminal output

noisily [:] command

Specify type of output to display

set output { proc | inform | error }

Description

quietly suppresses all terminal output for the duration of command. It is useful both interactively and in programs.

noisily turns back on terminal output, if appropriate, for the duration of command. It is useful only in programs.

set output specifies the output to be displayed. It is useful only in programs and even then is seldom used.

Example of interactive use

You do not care to see the output from a particular regression, but instead want to silently run the regression so that you may access some of its returned results.

. sysuse auto . quietly regress mpg weight foreign headroom

No output is presented, but the e() returned results from the regression are now available.

Note for programmers

If you write a program or ado-file, say, mycmd, there is nothing special you need to do so that your command can be prefixed with quietly. That said, c-class value c(noisily) (see [P] creturn) will return 0 if output is being suppressed and 1 otherwise. Thus your program might read

program mycmd ... display ... display ... ... end

or

program mycmd ... if c(noisily) { display ... display ... } ... end

The first style is preferred. If the user executes quietly mycmd, the output from display itself, along with the output of all other commands, will be automatically suppressed.

If the program must work substantially to produce what is being displayed, however, and the only reason for doing that work is because of the display, then the second style is preferred. In such cases, you can include the extra work within the block of code executed only when c(noisily) is true and thus make your program execute more quickly when it is invoked quietly.


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