Stata tip 124: Passing temporary variables to subprograms

The Stata Journal (2015), Vol.15, No. 2, pp. 597-598.

Abstract

When programming in Stata it is good practice to use temporary variables, scalars and matrices. It is also good practice to split up larger programs in smaller sub-routines. This Stata tip discusses how to pass temporary variables, scalar and matrices to these sub-routines, in such a way that the main program can still use them after the sub-routine has finished.

Full text