Generate variable that shows the question with the highest correct answers

#1
hi friends,

I asked 25 questions in a test.

q1
1=correct
0=incorrect

q2
1=correct
0=incorrect

So on,

I would like to know which of the 25 question has the most correct responses. I could tab each variable and know the answer but is there a way to create a new variable with this info? Perhaps egen, somenthing??
In order words I would like a single table with the frequencies of the 25 variables
new var
q1=12
q2=25
q3=23

so on...



Thank you all in advance!!
Marvin
 
Last edited:

bukharin

RoboStataRaptor
#2
One approach would be to -reshape- your data to long form; then you can use simple table commands. Assuming you have a subject number called -id- and that your question variables are named q1-q25 you could use:
Code:
reshape long q, i(id) j(question)
rename q correct // this is optional but gives nicer output
tab question correct