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: Calculating dynamic average per observation


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Calculating dynamic average per observation
Date   Wed, 12 Mar 2014 23:10:50 +0000

Both questions yield to standard -egen- functions. Study the help for
-egen- to find out about -rownonmiss()- and -rowmean()-.

For a more systematic review, see

http://www.stata-journal.com/article.html?article=pr0046

Incidentally, I can't see what is "dynamic" here.

Nick
[email protected]

On 12 March 2014 23:00, John Whitmer <[email protected]> wrote:

> I have a relatively large data set (~50k observations) that contains 9 variables representing quiz responses.  For each variable, 0 == wrong answer, 1 == correct answer, and a missing value indicates that they didn't answer the question.
>
> The challenge is that there are a lot of missing values, so I'd like to calculate/generate two new variables per observation:
>
> 1) the count of variables without missing values (e.g. the variables with some value, which is either 0/1).
> 2) the average score of all questions that they did answer (e.g. sum of all variables / count of variables without missing values).
>
> Ideas? The list of variables follows below, in case that's helpful/interesting.
>
> q2_subordinate_conj q2_subject_active_verb q3_action_verbs q3_subject_verb_agreement q4_clause q4_complex_sentence q5_audience q5_process q5_parallel_structure
*
*   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