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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Combining variables without adding


From   Cory Smith <corybsmith@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Combining variables without adding
Date   Wed, 23 Nov 2011 19:05:46 -0500

check out -rownonmiss- under egen. You could do

egen numAns = rownonmiss(peaches*) . This will count the number of
answers someone gave to peaches* questions (i.e. the number of
non-missing).

This will let you focus on the set where people answered correctly.
You'll have to pick how you want to deal with the people who answered
incorrectly.

Cory

On Wed, Nov 23, 2011 at 6:53 PM, Jessica Kopsic <jkops@andrew.cmu.edu> wrote:
>
> Hello all,
>
> I am using Stata 12.0.
>
> I have questions in a dataset answered with a Likert-type scale. The data
> is currently arranged so that each answer to each question is its own
> variable. So if the question is "Do you like peaches?" Then Peaches1 is a
> variable, Peaches2 is a variable, and so on. If the person selected one,
> there would be a 1 for the Peaches1 variable and the remaining Peaches
> variables would be blank. I would like to combine all the Peaches
> variables so that there is only one variable for response to the Peaches
> question, with possible values from 1 to 5.
>
> The complicating factor is that it was possible for people to erroneously
> select more than one answer. So if someone marked 1 and 4, they would have
> a value for Peaches1 and a value for Peaches4. If I simply added all the
> Peaches variables together, it would give them a 5, which is not correct.
> How can I avoid this? For some cases of more than one response I would
> like to use the mean, in others I would like to use the lowest response.
>
> Thank you!
>
>
> *
> *   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/

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