Statalist


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

Re: st: Re: spliting multiple response variable


From   Rajaram Subramanian Potty <rajara999@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: spliting multiple response variable
Date   Thu, 10 Sep 2009 13:09:15 +0530

Thanks for answering my posting and both the commands are working correctly.

RAJA

On Thu, Sep 10, 2009 at 12:10 PM, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
> --- On Thu, 10/9/09, Rajaram Subramanian Potty wrote:
>> I have a variable which is multiple response and is a
>> string variable and is in character. Now, I want to know how
>> may respondents was given different characters. The
>> following is the example of the variable with 5
>> observations
>>       Var1
>> 1. ABCDE
>> 2. BFGH
>> 3. ABIJK
>> 4. BDJK
>> 5. BC
>> Now, I want to know how many are answered A, or B or C
>> or D or E etc.
>
> *------------- begin example --------------
> clear
> input str5 y
> ABCDE
> BFGH
> ABIJK
> BDJK
> BC
> end
>
> gen a = strpos(y,"A") > 0
> gen b = strpos(y,"B") > 0
> gen c = strpos(y,"C") > 0
> gen d = strpos(y,"D") > 0
> gen e = strpos(y,"E") > 0
> gen f = strpos(y,"F") > 0
> gen g = strpos(y,"G") > 0
> gen h = strpos(y,"H") > 0
> gen i = strpos(y,"I") > 0
> gen j = strpos(y,"J") > 0
> gen k = strpos(y,"K") > 0
>
> list
> total a-k
> *------------- end example --------------
>
> Hope this helps,
> Maarten
>
>
>
>
> *
> *   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   |   What's new   |   Site index