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]

st: Calculating dynamic average per observation


From   John Whitmer <[email protected]>
To   [email protected]
Subject   st: Calculating dynamic average per observation
Date   Wed, 12 Mar 2014 16:00:42 -0700

Dear Stata Gurus,

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

Suggestions?  Thanks in advance for lending your expertise.

Best, John

*********************************************
John Whitmer, Ed.D.
E: [email protected]
Skype: john.whitmer
Office: 530.554.1528
Cell: 530.574.8827

http://www.johnwhitmer.net


*
*   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