. sysuse auto, clear
(1978 Automobile Data)
. di "I am getting some summary statistics for PRICE"
I am getting some summary statistics for PRICE
. su price
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
price | 74 6165.257 2949.496 3291 15906
.
end of do-file
I want to hide the command lines, and show only the results as follows:
I am getting some summary statistics for PRICE
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
price | 74 6165.257 2949.496 3291 15906
How can I do this? Thanks.
You can also use Mission Control to reveal hidden windows, or use Command–` (left quote) to cycle through all open Stata windows. Many of Stata's windows have functionality that can be accessed by clicking on the right mouse button (right-clicking) within the window.
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.
display displays strings and values of scalar expressions. display produces output from the programs that you write. Interactively, display can be used as a substitute for a hand calculator; see [R] display. You can type things such as display 2+2.
The Review window keeps a record of all commands Stata has run, both successful and unsuccessful. This can help you keep track of what you have done. You can copy and paste commands to this window, and can also re-run commands from this window.
The answer from user1493368 is correct, but writing code like that is tedious and error-prone for more complicated examples. Another answer is just to learn how to write Stata programs! Put this in a do-file editor window and run it
program myprog
qui sysuse auto, clear
di "I am getting some summary statistics for PRICE"
su price
end
Then type interactively
myprog
As in practice one makes lots of little mistakes, a very first line such as
capture program drop myprog
is a good idea.
This really is prominently and well documented: start with the later chapters in [U].
Try this: The output text file (quiet_noise. txt) will have the one you want.
quietly {
log using quiet_noise.log, text replace
sysuse auto
noisily: di "I am getting some summary statistics for PRICE"
noisily: su price
log close
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With