[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: RE: Replacing Missing Values for multiple variables at one time?
You can loop using -while-, -forvalues- or -foreach-.
All these constructs resemble standard constructs in most other programming
languages. The canonical source is [P]. The main need is
really to understand how to use local macros to control looping
On -forvalues- and -foreach-,
. search forvalues
would point you to various material, including
FAQ . . . . . . . . . . . . . . . . Looping over parallel lists in Stata 8
12/04 How do I process parallel lists in Stata 8?
FAQ . . . . . . . . . . Going through groups in order of first occurrence
9/05 How do I go through the groups of a variable in
order of their first occurrence in the dataset?
FAQ . . . . . . . . . . Making foreach go through all values of a variable
8/05 Is there a way to tell Stata to try all values of a
particular variable in a foreach statement without
FAQ . . . . . . . . . Counting distinct strings across a set of variables
7/04 How do I count the number of distinct strings
across a set of variables?
SJ-3-2 pr0009 . . . . . . . . . . . . . Speaking Stata: Problems with lists
Q2/03 SJ 3(2):185--202 (no commands)
discusses ways of working through lists held in macros
SJ-2-2 pr0005 . . . . . . Speaking Stata: How to face lists with fortitude
Q2/02 SJ 2(2):202--222 (no commands)
demonstrates the usefulness of for, foreach, forvalues, and
local macros for interactive (non programming) tasks
The last two may be closest to what you need. A Google on "how to face lists
with fortitude" will find internet sources of a shortened version of
SJ 2(2): 202-222 (2002), the numerology of which is purely fortuitous.
> Is there a tutorial out there that shows how loops are coded in Stata?
* For searches and help try: