I have a dataset in which the unit of analysis is individual citizens. I then have a large number of variables showing whether a certain medicial document was fetched (1 equals fetched) in order to assess the citizens case. The relevant data for this questions looks like this:
citizen_id | med1 | med2 | med3 | med4 | med5 | med6 |
1 | 0 | 0 | 1 | 1 | 0 | 0 |
2 | 0 | 1 | 1 | 0 | 0 | 1 |
3 | 1 | 0 | 1 | 1 | 0 | 0 |
I can think of one solution, which however would be very time consuming, which is to generate a variable showing the number of times two medicial documents are fetched together
Code:
gen medcomb = 0 replace medcomb = 1 if med1 ==1 & med2==1 replace medcomb = 2 if med1==1 & med3==1 replace medcomb = 3 if med1==1 & med4==1
Code:
tab medcomb
0 Response to Finding the two binary variables most frequently equalling one together across a set of binary variables
Post a Comment