Is there a way to delay the complete execution of a command till the end of do-file? So wherever this command is typed in the do-file -even at the top of the do-file- it would wait till the end of do-file, and provide output just before the do-file ends. Something like "collect information and run this command now, but show the output only when the do-file ends." Note that this is a single line of command that would not require writing additional lines of code at the bottom of the do-file.
A simple example is below (but what I actually want to do is more complicated than this example).
A simple example is below (but what I actually want to do is more complicated than this example).
Code:
use https://www.stata-press.com/data/r16/auto, clear replace price=1000 if mpg>30 cap summ price // Below is the -doend- command that would collect information at this // position in the do-file but delay its execution till the end of do-file doend: display r(mean) drop if mpg>20 // So without any additional lines of command, when the do-file ends, // it provides the output of "display r(mean)" but the output would reflect // the status of data before "drop if mpg>20" command line.
Comment