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]

st: Creating dummy variables


From   Anup Nandialath <[email protected]>
To   [email protected]
Subject   st: Creating dummy variables
Date   Sat, 13 Jul 2013 20:50:57 +0400

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/


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