Using loops and macros in Stata can hold many advantages, mainly reducing the length of your do files, allowing errors to be tracked and fixed quickly and efficiently, faster running do files and providing us with re-usable programs which can be used in subsequent data analyses with similar scenarios. In this presentation we shall cover the following areas: * Storing global and local macros within Stata, with applied examples including storing categories of a variable, storing data summaries and names of files within a directory. * The commands foreach, forval and while, with applied examples. * Applied examples of how to combine macros with loops and show why this can be useful.
In order to set up a list of libraries that you have access to,
you must first login
or sign up.
Then set up a personal list of libraries from your profile page by
clicking on your user name at the top right of any screen.