Dear forum members,
I am decently familiar with Stata data management but have recently been stumped by this problem which I am sure has a simple answer. The problem is that
1. I have two variables phakia_re and phakia_le, both of which take values ranging from 0/2 representing 0=phakia, 1=aphakia and 2=pseudophakia respectively for each eye in a person
2. Each observation represents a person
3. I need to create a person level status by combinations of these two variables. These possible combinations are: 00, 01, 02, 11, 12, 22
The simple way is to handcode these. But I was looking for a command designed for this purpose in a more elegant manner.
I have tried generating operatedCatType_person using egen, group but it did not help did not help since the results was permutations rather than combinations.
Same was the case with the SSC groups command. Any help will be much appreciated.
Thanks
Vivek
I am decently familiar with Stata data management but have recently been stumped by this problem which I am sure has a simple answer. The problem is that
1. I have two variables phakia_re and phakia_le, both of which take values ranging from 0/2 representing 0=phakia, 1=aphakia and 2=pseudophakia respectively for each eye in a person
2. Each observation represents a person
3. I need to create a person level status by combinations of these two variables. These possible combinations are: 00, 01, 02, 11, 12, 22
The simple way is to handcode these. But I was looking for a command designed for this purpose in a more elegant manner.
I have tried generating operatedCatType_person using egen, group but it did not help did not help since the results was permutations rather than combinations.
Code:
list phakic_re phakic_le , nol clean noobs phakia_re phakia_le 0 2 2 0 2 0 2 2 2 0 2 0 2 0 2 2 2 0 egen operatedCatType_person = group(phakic_re phakic_le) list phakic_re phakic_le operatedCatType_person , nol clean noobs phaki~re phaki~le operat~1 0 2 2 2 0 6 2 0 6 2 2 8 2 0 6 2 0 6 2 0 6
Thanks
Vivek
Comment