st: Re: repeating analysis for groups

There are a number of approaches you can use:
1) bys group: tab race * etc */
2) forvalues i = 1/ [put the highest value of group here]{
*/ all of your analyses here */
tab race if group == `i'
tab sex if group ==`i'
tab race sex if group == `i'
}

Let's say you have groups defined by three-digit SIC codes, which are
not consecutive integers, and you want to do more than one thing per
group (e.g. run a regression and save the predicted values). Approach 1
will not work, nor will approach 2. A variation on approach 2 is to use
foreach: