Hello,
I have a dataset with 10 variables and 5 binary variables (A, B, C,D,E). I'm trying to get all possible combinations of 2,3, 4 and 5 of all but I'm not sure how to go about this using a loop/permin,combin in Stata. Moreover, I want Stata to count each combination iteration and tell me the sum of times each variable (intersection in combinations/permutations) is is 1.
The data is such that the number of A=1 (say 5) instances adds upto A=1 in all other iterations ( A=1 + B=1 +C=1 (2), A=1+C=1 (3). For example, I've been trying:
tab A if A !=0 & B !=0 & C !=0
I'm having difficulties getting the combinations with a loop (minimum code) and also tallying up all iterations to 5.
* Example generated by -dataex-. To install: ssc install dataex
clear
input byte(A B C D E)
1 0 0 0 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 0 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 0 1
1 0 0 0 0
0 0 0 0 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
0 0 0 0 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 0 0
1 0 0 0 1
1 0 0 0 1
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 0 1
1 0 0 0 1
1 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 1
0 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
0 0 0 0 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
Related Posts with Combinations of binary variables
multiple imputation (MICE) and varying estimation sample!Hello, I am building a regression model for ethnicity as a categorical exposure variable and death a…
precoin error 3301When I run precoin using the sample data of 100 obs, it works successfully. However , it doesn't wor…
CI 95% generated by Meta set is slightly different than the CI generated by Metan codeI have been using STATA 14 for so long and I have run a lot of meta-analysis with no trouble. Recent…
Fixed Effects Regressions with Time and Individual Fixed EffectsHello, The following questions are to essentially check whether I am carrying out the correct econo…
Advice on suitability of panel design for studyHi all, I am under the impression that the panel format is not appropriate for my study and am stro…
Subscribe to:
Post Comments (Atom)
0 Response to Combinations of binary variables
Post a Comment