Hi,

Relativley new to stata- I am using a data set with 619 participants, I created a composite measure called CDS( chronic disease syndrome) that should be 1= if ANY one of the following ( diabetes, obesity, or hypertension) and 0 if all diabetes, obesity AND hypertension =0. In order to do this, I made obesity, diabetes and hypertension binary. I expected my composite measure CDS = 1 to equal to the sum of yes/1 in each individual in the composite

My issue is that when I tabulate the composite measure and count the composite number of yes, I get a number that is NOT equal to the tabulation of each individual yes

ex: cdm, chronic diabetes, YEs -27
chtn, chronic hypertension, yes=24
obese_bi_1= binary obesity variable, yes= 112

expected CDS_1 if any CDM, CHTN, obese=1 to be 112+24+27 , but instead it 136,

I tried to show some of my output, below, generating the CDS variable, and then some simple tab, cross tabs so you can see the total of th individual variables

.
. **Generate a composit measure for exposure for preg 1 (CDS)--- where Chronic disease syndrome (com
> posite measure) === Chronic htn, chronic dm, obesity
. generate CDS_1=1 if chtn_bi_1==1| CDM_1==1|obese_bi_1==1
(483 missing values generated)

. replace CDS_1=0 if chtn_bi_1==0 & CDM_1==0 & obese_bi_1==0
(483 real changes made)

. label define CDS_1_name 0"No CDS" 1"Any CDS"

. label values CDS_1 CDS_1_name

. tab CDS_1

CDS_1 | Freq. Percent Cum.
------------+-----------------------------------
No CDS | 483 78.03 78.03
Any CDS | 136 21.97 100.00
------------+-----------------------------------
Total | 619 100.00


| HDP_2
chtn_bi_1 | No HDP HDP | Total
---------------+----------------------+----------
No Chronic HTN | 536 59 | 595
| 97.45 85.51 | 96.12
---------------+----------------------+----------
Chronic HTN | 14 10 | 24
| 2.55 14.49 | 3.88
---------------+----------------------+----------
Total | 550 69 | 619
| 100.00 100.00 | 100.00


tab CDM_1

CDM_1 | Freq. Percent Cum.
------------+-----------------------------------
No CDM | 592 95.64 95.64
CDM | 27 4.36 100.00
------------+-----------------------------------
Total | 619 100.00



. tab obese_1 //categorical obese variable

obese_1 | Freq. Percent Cum.
------------------------+-----------------------------------
Not obese | 316 54.02 54.02
overweight | 157 26.84 80.85
obese or morbidly obese | 112 19.15 100.00
------------------------+-----------------------------------
Total | 585 100.00

.
.
.
. gen obese_bi_1 = 1 if obese_1 == 2
(507 missing values generated)

. replace obese_bi_1 = 0 if obese_1==.| obese_1==1 | obese_1 ==0
(507 real changes made)

. label define obese_bi_1_names 0"not obese" 1"obese"

. label values obese_bi_1 obese_bi_1_names //binary obese variable



| obese_bi_1
sex_1 | not obese obese | Total
-----------+----------------------+----------
F baby | 258 57 | 315
| 50.89 50.89 | 50.89
-----------+----------------------+----------
M baby | 249 55 | 304
| 49.11 49.11 | 49.11
-----------+----------------------+----------
Total | 507 112 | 619
| 100.00 100.00 | 100.00


.