If you want to repeat the summary statistics by year, you can use the bysort
prefix. see the following example,
webuse grunfeld, clear
bys year: asdoc sum, replace
For your second query, you can use the save()
option of asdoc. So assume that you have a directory in C:/results
and you want to save the output to this directory. You would use the save option as shown below.
webuse grunfeld, clear
bys year: asdoc sum, replace save(C:/results/Myfile.doc)