Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Thomas Speidel <thomas@tmbx.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: egen rowmean, loops and if |

Date |
Tue, 05 Apr 2011 14:01:38 -0700 |

where occ_~1_1 = occ_met1_1 occ_~2_1 = occ_met2_1 occ_~3_1 = occ_met3_1 Of course, the data is much wider (and taller), with occ_metj_i j = 1 to <=3 i = 1 to <=8

+-----------------------------------------------------+ | id occ_~1_1 occ_~2_1 occ_~3_1 mean1_1 mean2_1 | |-----------------------------------------------------| | 1 4 7 . 5.50 . | | 2 1.5 . . . 1.50 | | 3 2.3 3.3 . 2.80 . | | 4 3.3 2.3 3.5 3.03 . | | 5 1.5 . . . 1.50 | |-----------------------------------------------------| | 6 1.5 . . . 1.50 | | 7 2.3 . . 2.30 . | | 8 1.5 . . . 1.50 | | 9 1.5 2.3 3.3 2.80 1.50 | | 10 1.5 2.3 3.3 2.80 1.50 | +-----------------------------------------------------+

foreach j of num 1/3 { foreach i of num 1/8 {

} } Any suggestions (short of reshaping)? Thanks. -- Thomas Speidel * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: egen rowmean, loops and if***From:*Thomas Speidel <thomas@tmbx.com>

- Prev by Date:
**RE: st: problem with latest update?** - Next by Date:
**Re: st: egen rowmean, loops and if** - Previous by thread:
**st: PCA with unbalanced data** - Next by thread:
**Re: st: egen rowmean, loops and if** - Index(es):