Bookmark and Share

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]

Re: st: standardizing scores by cohort


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
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
[email protected]

On 24 April 2013 12:15, Paul Byatta <[email protected]> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index