An answer, and ways of doing this so that the problem
does not arise, may be found in
http://www.stata.com/support/faqs/data/foreach.html
Nick
[email protected]
Joe McCrary
> I'm running a tabstat over 10 grade (3 through 12) over several
> variables. When it gets to grade 9 for one variable, the command stops
> processing because there are no observations for grade 9. Is there a
> way I can force the command to continue to run through grade 10-12?
>
> Command:
> .
> . forvalues c=3/12 {
> 2. display " "
> 3. display " "
> 4. display "Percent Prof/Adv, Language Arts, Grade `a'"
> 5. display "School-Level Minimum, Maximum, Mean, & Median"
> 6. tabstat pctlap`c', by( stfips) statistics(count min max mean
> median) casewise format nototal
> 7. }
>
> Output:
>
> Percent Prof/Adv, Reading/Language Arts, Grade 8
> School-Level Minimum, Maximum, Mean, & Median
>
> Summary for variables: pctrlap8
> by categories of: stfips (State FIPS code)
>
> stfips | N min max mean p50
> -------+--------------------------------------------------
> GA | 461.0 100.0 100.0 100.0 100.0
> KY | 327.0 0.0 0.0 0.0 0.0
> RI | 62.0 100.0 139.1 109.4 108.0
> VT | 127.0 72.7 100.0 98.3 100.0
> WV | 184.0 150.0 200.0 179.6 180.1
> ----------------------------------------------------------
>
>
> Percent Prof/Adv, Reading/Language Arts, Grade 9
> School-Level Minimum, Maximum, Mean, & Median
> no observations
> r(2000);
>
> end of do-file
> r(2000);
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/