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: another coding que to group vars
From
Eric Booth <[email protected]>
To
[email protected]
Subject
Re: st: another coding que to group vars
Date
Wed, 11 Apr 2012 17:29:25 -0500
<>
Take a look at -egen- function group()
e.g., egen TYPE = group(Y1-Y6)
- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754
On Apr 11, 2012, at 2:12 PM, Rituparna Basu wrote:
> Dear Statalist Scholars,
>
> I have yet another coding question to ask. Please see the mock data below:
>
> ID Y1 Y2 Y3 Y4 Y5 Y6 TYPE
> 1 x x x x x x type1
> 2 y y y y y y type2
> 3 x x x x . x type1
> 4 x y y x x x type3
> 5 y y y x x x type4
> 6 x . y . . x type3
> 7 x y x x . . type3
> 8 x x x x . . type5
> 9 y y y y . . type6
>
>
> Here ID= Patient ID
> Y1-Y6= years
> X & Y are two types of group
> TYPE= This is the variable I would like to CREATE by grouping x & y into six categories. (type 1 is group X thru out, type 2 is group Y thru out, type 3 is started as group X and then changed to Y at any time point, type 4 is started as Y and then changed to X at any time point, type 5 & 6 have either X or Y thru out except the last TWO years)). The types includes missing.
>
> Any help is very much appreciated! Please let me know if more clarification is needed.
>
> Thank you in advance!
>
> Regards,
>
> RB
>
> *
> * 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/