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: Creating choice indicator!


From   Joerg Luedicke <[email protected]>
To   [email protected]
Subject   Re: st: Creating choice indicator!
Date   Tue, 20 Mar 2012 10:19:30 -0700

Do I understand this correctly: the IDs could have zero, one, or more
than one choices, and you want to indicate whether they made exactly
one choice or zero choices? If this is correct, such an
indicator/dummy/binary variable is logically impossible because what
should happen to those with more than one choices? You could indicate
3 levels:

bys id: egen choice=total(chosen)
recode choice 0=0 1=1  2/5=2

and then deal with choice==2 in some (appropriate) way.

J.


On Tue, Mar 20, 2012 at 9:51 AM, Peter Grand <[email protected]> wrote:
> Dear Statalisters!
>
> How can I create a random binary variable which indicates either only one chosen alternative or none of them within an id variable, e.g. 5 choices for each individual id :
>
>
> id   chosen
> 1       0
> 1       0
> 1       1
> 1       0
> 1       0
> 2       0
> 2       0
> 2       0
> 2       0
> 2       0
> 3       0
> 3       1
> 3       0
> 3       0
> 3       0
>
>
> Thank you very much!
>
> Best,
>
> Peter Grand
> grand(at)ihs.ac.at
> Institute for Advanced Studies
> Stumpergasse 56
> 1060 Vienna
>
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index