Hi,
I am trying to generate new variables in a stata dataset which includes all pairwise and triplets combinations of a count of 14 conditions. The conditions are listed as values in one variable 'chrondis' 1 to 14.
chrondis | Freq. Percent Cum.
------------+-----------------------------------
cardio | 60 0.95 0.95
cataracts | 106 1.67 2.62
highbp | 623 9.83 12.45
highchol | 1,214 19.16 31.61
stroke | 54 0.85 32.47
diabetes | 308 4.86 37.33
lungdis | 101 1.59 38.92
asthma | 369 5.82 44.74
artritis | 1,581 24.95 69.70
osteoart | 611 9.64 79.34
cancer | 448 7.07 86.41
parkins | 37 0.58 86.99
stomachul | 554 8.74 95.74
hipfrac | 270 4.26 100.00
------------+-----------------------------------
Total | 6,336 100.00
Alternatively, there are 14 binary variables for each condition 0=condition not present, 1=condition present.
Is there a way to calculate all possible 2way and 3way unique combinations (without repetition, order is not important) in Stata 12.
Thanks,
Olga
I am trying to generate new variables in a stata dataset which includes all pairwise and triplets combinations of a count of 14 conditions. The conditions are listed as values in one variable 'chrondis' 1 to 14.
chrondis | Freq. Percent Cum.
------------+-----------------------------------
cardio | 60 0.95 0.95
cataracts | 106 1.67 2.62
highbp | 623 9.83 12.45
highchol | 1,214 19.16 31.61
stroke | 54 0.85 32.47
diabetes | 308 4.86 37.33
lungdis | 101 1.59 38.92
asthma | 369 5.82 44.74
artritis | 1,581 24.95 69.70
osteoart | 611 9.64 79.34
cancer | 448 7.07 86.41
parkins | 37 0.58 86.99
stomachul | 554 8.74 95.74
hipfrac | 270 4.26 100.00
------------+-----------------------------------
Total | 6,336 100.00
Alternatively, there are 14 binary variables for each condition 0=condition not present, 1=condition present.
Is there a way to calculate all possible 2way and 3way unique combinations (without repetition, order is not important) in Stata 12.
Thanks,
Olga