Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

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

Subject |
Re: st: standardizing scores by cohort |

Date |
Wed, 24 Apr 2013 12:32:21 +0100 |

Statalist software here can't represent the equals sign = in your post correctly. I guess that, contrary to request, you are not sending plain text to the list. That aside egen mean_math = mean(math), by(yoa) egen sd_math = sd(math), by(yoa) gen std_math = (math - mean_math) / sd_math should be simpler than the dreaded alternative. Note that a -by()- option is supported, although not documented, by -egen-'s -mean()- and -sd()- functions, but your indicated syntax ... by yoa certainly would not work. Nick njcoxstata@gmail.com On 24 April 2013 12:15, Paul Byatta <paulbyatta@gmail.com> wrote: > I am trying to standardize raw > scores for several cohorts of students based on year of admission to high > school. > > My data looks like this > > > StudentID Year of math > Admission (yoa) > > 1 2004 78 > 2 2004 83 > 3 2004 99 > 4 2005 58 > 5 2005 68 > 6 2005 67 > 7 2006 87 > 8 2006 75 > 9 2006 56 > > It would have been easier to use > > > egen std_math =3D std(math) by yoa > > But then egen doesn=92t go with =93by=94 in this case. > > Anybody with a suggestion of how standardize the scores without having to > through the long process that is (below) and combining the generated > variables to get std_math? > > > > egen std_math4 =3D std(math) if yoa=3D=3D2004 > egen std_math5 =3D std(math) if yoa=3D=3D2005 > egen std_math6 =3D std(math) if yoa=3D=3D2006 > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: standardizing scores by cohort***From:*Paul Byatta <paulbyatta@gmail.com>

**References**:**st: standardizing scores by cohort***From:*Paul Byatta <paulbyatta@gmail.com>

- Prev by Date:
**RE: st: Compute Z-score** - Next by Date:
**st: Keepping observations that satisfy a concrete feature in the last period** - Previous by thread:
**st: standardizing scores by cohort** - Next by thread:
**Re: st: standardizing scores by cohort** - Index(es):