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: dropping the lowest three observations


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: dropping the lowest three observations
Date   Thu, 14 Feb 2013 12:57:36 -0600

I might be easiest to reshape long and then back to wide:

clear
input str1 student q1 q2 q3 q4 q5 q6 q7 q8 q9 q10
"A" 9 8 3 0 10 10 0 8 9 9
"B" 1 2 3 4 5 6 7 8 9 10
"C"  9 7 5 10 2 4 5 0 0 2
end
l

reshape long q, i(st)
bys st (q): replace q =  . if _n < 4
reshape wide q, i(st) j(_j)
egen average = rowmean(q*)
l

Scott

On Thu, Feb 14, 2013 at 12:38 PM, John Levendis
<[email protected]> wrote:
> Hello Statalisters,
>
> I'm doing my grading on Stata, and I'd like to drop each student's
> lowest three grades. Each row is a student, and for each student I have
> their quiz grades as Q1, Q2, Q3, and so on. How can I compute their
> average grades while dropping their lowest three Qs? Incidentally, these
> quiz grades are out of 10 pts, so it is quite common for students to
> have multiple quizzes with the same scores. (Some kind of nested rmin()
> function, I'm sure, but I can't figure it out.)
>
> Thanks, as always, for you help.
>
> --John Levendis
>
> *
> *   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/
*
*   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