Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Generate new var - sum of multiple var


From   Jonathan Grondin <jona.grondin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Generate new var - sum of multiple var
Date   Tue, 23 Aug 2011 11:20:09 -0400

Hello everyone,

I have a 4 questions survey(q1, q2, q3, q4). Each one of the 4
questions can either be answered by 1 or by 0.
I'd like to generate a new variable(new_var) holding, for every
participants, the number of question they answered with the value 1.
In other word, the sum of the 4 questions.

new_var would then hold values from 0 to 4


Any suggestions ?


Jonathan
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index