Return and ereturn list
All the postestimation commands work because the "regress" command stores some data. You will learn more on this in the "Objects, loops, and branching" chapter. For now, let's just have a quick look in case you are interested in a specific result.
/*
All estimation commands store their results in the "ereturn" list:
*/
sysuse auto, clear
reg price weight length
ereturn list
/*
To display single objects, type "display" and the name for scalars and macros,
and "matrix list" for matrices (more in the respective chapters).
*/
display e(N)
display e(depvar)
matrix list e(b)
/*
This list is overwritten after each new estimation.
*/
reg price weight length i.foreign
ereturn list
/*
Some non-estimation commands also store some results. They use the "return" list.
*/
summarize price
return list
How do I know what is stored in the return/ereturn list? The easiest way is to simply type "return list" and "ereturn list" after the command was run. Also, the help-files of commands usually have a list of stored results at the very end.
You will need this information for more flexible graphs and tables. In addition, it will help you to make your code less error prone, and makes your code reproducible (check out the chapter on "Replication & transparency".)