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 dummy variables


From   Anup Nandialath <[email protected]>
To   [email protected]
Subject   Re: st: Creating dummy variables
Date   Sat, 13 Jul 2013 21:23:48 +0400

Hi Jim,

Yes I did look that up. But the issue is I have about 30 Groups in my
dataset (under the group var) and using the xi or the tab group,
gen(dummy) command will create dummies for all the variables. I wanted
to check if I could just create dummies for the variables which form
part of the output from the conditional tabulate statement.

Thanks
Anup

On Sat, Jul 13, 2013 at 9:15 PM, Jim Bang <[email protected]> wrote:
> Have you tried the "xi" commands?
>
> On Sat, Jul 13, 2013 at 11:50 AM, Anup Nandialath
> <[email protected]> wrote:
>> Dear Statalisters,
>>
>> I have a question with respect to creating dummy variables.
>>
>> First, I tabulate data based on a specific condition
>>
>> tab group if A==1
>>
>> and the Stata and example output (partial) looks as follows
>>
>>
>>  Group   |      Freq.     Percent        Cum.
>> -----------------------------------+----------
>>  Group 1 |         34        4.34        4.34
>>  Group 2 |         10        1.28        5.62
>>  Group 3 |         22        2.81        8.43
>>  Group 4 |         35        4.47       13.15
>>  Group 5 |         14        1.79       14.94
>> -----------------------------------------+---
>>
>> In my dataset I have more than 30 groups (of which only some meet the
>> required condition). Therefore my task is to create a dummy variable
>> which will take the value of 1 if it belongs to any of the groups
>> which are listed as output from the conditional table and zero
>> otherwise.
>>
>> Any help in this direction is much appreciated.
>>
>> Thanks
>>
>> Anup
>> *
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index