Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Coding participants with metabolic syndrome

    Hi there,

    I would like to categorize participants in a dataset that I am using by whether or not they have metabolic syndrome. However, I am having trouble with this because you need 3/5 criteria below to meet metabolic syndrome:
    • Abdominal obesity (Waist circumference of greater than 40 inches in men, and greater than 35 inches in women)
    • Triglyceride level of 150 milligrams per deciliter of blood (mg/dL) or greater
    • HDL cholesterol of less than 40 mg/dL in men or less than 50 mg/dL in women
    • Systolic blood pressure (top number) of 130 millimeters of mercury (mm Hg) or greater, or diastolic blood pressure (bottom number) of 85 mm Hg or greater
    • Fasting glucose of 100 mg/dL or greater
    So, I am wondering how I can use if statements or some other command in Stata to code a variable called met_syn with 0 = does not have metabolic syndrome and 1 = has metabolic syndrome. Anyone with any 3 of the 5 criteria above should be classified as having metabolic syndrome.

    Here is a small part of the dataset I am working with:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long pid float(sex_r waist_in) int trigs1 byte hdlc1 int(avgsbp1 avgdbp1 glucose1)
    10002 0  42.20475 256 24 134 71 104
    10005 0 33.858288 117 87 121 66  96
    10008 0  41.53545 238 42 128 76 105
    10011 1  37.34254  98 33 142 82 110
    10012 0  48.81892 135 53 139 83  95
    10013 0  50.07877 161 80 147 75  90
    10015 0  43.74018  66 50 123 75 114
    10017 1  42.02758  75 51 151 83  85
    10024 0  52.12601  94 51 127 78  90
    10025 1  48.48428 183 38 144 79 104
    end
    label values sex_r Sex
    label def Sex 0 "Female", modify
    label def Sex 1 "Male", modify
    pid - participant
    sex_r - sex (0 = female, 1 = male)
    trigs1- triglyceride level
    hdlc1 - HDL cholesterol level
    avgsbp1 = average systolic blood pressure
    avgdbp1 = average diastolic blood pressure
    glucose1 = fasting glucose level

    I am not sure if any of these 10 participants will actually have metabolic syndrome, but any code I could use in my larger dataset would be greatly appreciated.

    Thank you.

  • #2
    You can try something like the following.
    Code:
    version 16.1
    
    clear *
    
    quietly input long pid float(sex_r waist_in) int trigs1 ///
         byte hdlc1 int(avgsbp1 avgdbp1 glucose1)
    10002 0  42.20475 256 24 134 71 104
    10005 0 33.858288 117 87 121 66  96
    10008 0  41.53545 238 42 128 76 105
    10011 1  37.34254  98 33 142 82 110
    10012 0  48.81892 135 53 139 83  95
    10013 0  50.07877 161 80 147 75  90
    10015 0  43.74018  66 50 123 75 114
    10017 1  42.02758  75 51 151 83  85
    10024 0  52.12601  94 51 127 78  90
    10025 1  48.48428 183 38 144 79 104
    end
    
    label define Sexes 0 Female 1 Male
    label values sex_r Sexes
    
    *
    * Begin here
    *
    assert inlist(sex, "Male":Sexes, "Female":Sexes)
    // Waist circumference > 40 in. in men | > 35 in. in women
    generate byte met_syn = ///
        cond(sex == "Male":Sexes, waist_in > 40, waist_in > 35) ///
            & !mi(waist_in)
    list , noobs separator(0) abbreviate(20)
    
    // Triglyceride level ≥ 150 mg%
    quietly replace met_syn = met_syn + 1 if trigs1 >= 150 & !mi(trigs1)
    list , noobs separator(0) abbreviate(20)
    
    // HDL cholesterol < 40 mg% in men | < 50 mg% in women
    quietly replace met_syn = met_syn + ///
        cond(sex == "Male":Sexes, hdlc1 < 40, hdlc1 < 50)
    list , noobs separator(0) abbreviate(20)
    
    // Systolic blood pressure ≥ 130 mm Hg | diastolic blood pressure ≥ 85 mm Hg
    quietly replace met_syn = met_syn + 1 ///
        if (avgsbp1 >= 130 & !mi(avgsbp1)) | (avgdbp1 >= 85 & !mi(avgdbp1))
    list , noobs separator(0) abbreviate(20)
    
    // Fasting blood glucose ≥ 100 mg%
    quietly replace met_syn = met_syn + 1 if glucose1 >= 100 & !mi(glucose1)
    list , noobs separator(0) abbreviate(20)
    
    // Anyone with any 3 of the 5 criteria classified as having metabolic syndrome.
    quietly replace met_syn = met_syn >= 3
    list , noobs separator(0) abbreviate(20)
    
    exit
    I've sprinkled -list- at each step so that you can see the evolution of the changes in the index variable as each criterion is evaluated, but you can rid them in production code.
    Last edited by Joseph Coveney; 05 Nov 2020, 19:45.

    Comment


    • #3
      Originally posted by Joseph Coveney View Post
      You can try something like the following.
      Code:
      version 16.1
      
      clear *
      
      quietly input long pid float(sex_r waist_in) int trigs1 ///
      byte hdlc1 int(avgsbp1 avgdbp1 glucose1)
      10002 0 42.20475 256 24 134 71 104
      10005 0 33.858288 117 87 121 66 96
      10008 0 41.53545 238 42 128 76 105
      10011 1 37.34254 98 33 142 82 110
      10012 0 48.81892 135 53 139 83 95
      10013 0 50.07877 161 80 147 75 90
      10015 0 43.74018 66 50 123 75 114
      10017 1 42.02758 75 51 151 83 85
      10024 0 52.12601 94 51 127 78 90
      10025 1 48.48428 183 38 144 79 104
      end
      
      label define Sexes 0 Female 1 Male
      label values sex_r Sexes
      
      *
      * Begin here
      *
      assert inlist(sex, "Male":Sexes, "Female":Sexes)
      // Waist circumference > 40 in. in men | > 35 in. in women
      generate byte met_syn = ///
      cond(sex == "Male":Sexes, waist_in > 40, waist_in > 35) ///
      & !mi(waist_in)
      list , noobs separator(0) abbreviate(20)
      
      // Triglyceride level ≥ 150 mg%
      quietly replace met_syn = met_syn + 1 if trigs1 >= 150 & !mi(trigs1)
      list , noobs separator(0) abbreviate(20)
      
      // HDL cholesterol < 40 mg% in men | < 50 mg% in women
      quietly replace met_syn = met_syn + ///
      cond(sex == "Male":Sexes, hdlc1 < 40, hdlc1 < 50)
      list , noobs separator(0) abbreviate(20)
      
      // Systolic blood pressure ≥ 130 mm Hg | diastolic blood pressure ≥ 85 mm Hg
      quietly replace met_syn = met_syn + 1 ///
      if (avgsbp1 >= 130 & !mi(avgsbp1)) | (avgdbp1 >= 85 & !mi(avgdbp1))
      list , noobs separator(0) abbreviate(20)
      
      // Fasting blood glucose ≥ 100 mg%
      quietly replace met_syn = met_syn + 1 if glucose1 >= 100 & !mi(glucose1)
      list , noobs separator(0) abbreviate(20)
      
      // Anyone with any 3 of the 5 criteria classified as having metabolic syndrome.
      quietly replace met_syn = met_syn >= 3
      list , noobs separator(0) abbreviate(20)
      
      exit
      I've sprinkled -list- at each step so that you can see the evolution of the changes in the index variable as each criterion is evaluated, but you can rid them in production code.
      Hi Joseph,

      Thank you so much. This worked perfectly.

      However, I made a couple mistakes with the metabolic syndrome criteria. The major mistake was failing to include participants who were taking blood pressure, glucose lowering, or lipid lowering medications as meeting the corresponding blood pressure, glucose level, HDL, or triglycerides criterions. For example, if a participants blood pressure is below 130/85, but they are taking a blood pressure medication, they still meet the blood pressure criterion for metabolic syndrome. The other mistake was that the blood pressure criterion applies to those with a blood pressure >=130/85, not a systolic blood pressure >130 or a diastolic blood pressure >85 as I wrote above.

      I am pasting the correct metabolic syndrome criteria here:

      ATP III criteria define metabolic syndrome as the presence of any three of the following five traits:

      ● Abdominal obesity, defined as a waist circumference ≥40 inches in men and ≥35 inches in women

      ● Serum triglycerides ≥150 mg/dL (1.7 mmol/L) or drug treatment for elevated triglycerides

      ● Serum high-density lipoprotein (HDL) cholesterol <40 mg/dL (1 mmol/L) in men and <50 mg/dL (1.3 mmol/L) in women or drug treatment for low HDL cholesterol

      ● Blood pressure ≥130/85 mmHg or drug treatment for elevated blood pressure

      ● Fasting plasma glucose ≥100 mg/dL (5.6 mmol/L) or drug treatment for elevated blood glucose

      Here is a small sample of my dataset with the additional medication variables that were missing from my post above.

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input long pid float(sex_r avg_waist_in1) int trigs1 byte hdlc1 int(avgsbp1 avgdbp1) float bp_135_85 int glucose1 byte(lipid_meds bp_meds glucose_meds)
      10002 0 42.20472 256 24 134 71 0 104 0 1 0
      10005 0 33.85827 117 87 121 66 0  96 1 0 0
      10008 0 41.53543 238 42 128 76 0 105 1 1 0
      10011 1 37.34252  98 33 142 82 0 110 0 1 1
      10012 0  48.8189 135 53 139 83 0  95 0 0 0
      10013 0 50.07874 161 80 147 75 0  90 1 1 0
      10015 0 43.74016  66 50 123 75 0 114 0 0 0
      10017 1 42.02756  75 51 151 83 0  85 1 1 0
      10024 0 52.12598  94 51 127 78 0  90 0 0 0
      10025 1 48.48425 183 38 144 79 0 104 0 1 0
      end
      label values sex_r Sex
      label def Sex 0 "Female", modify
      label def Sex 1 "Male", modify
      label values bp_135_85 BP_135_85
      label def BP_135_85 0 "No", modify
      label values lipid_meds Medications
      label values bp_meds Medications
      label values glucose_meds Medications
      label def Medications 0 "No", modify
      label def Medications 1 "Yes", modify
      Again,

      pid - participant
      sex_r - sex (0 = female, 1 = male)
      trigs1- triglyceride level
      hdlc1 - HDL cholesterol level
      avgsbp1 = average systolic blood pressure
      avgdbp1 = average diastolic blood pressure
      bp_135_85 = BP >=135/85 (0 = no, 1 = yes)
      glucose1 = fasting glucose level
      lipid_meds = taking lipid lowering medications (0 = no, 1 = yes)
      bp_meds = taking blood pressure medications (0 = no, 1 = yes)
      glucose_meds = taking glucose lowering medications (0 = no, 1 = yes)

      For the triglyceride and HDL criterions above, if a participant is coded as "yes (1)" for taking lipid lowering medications, then they are a "yes" for both of those criterions.

      I would greatly appreciate if you could provide code that includes these additional parameters.

      Thank you so much.
      Last edited by Harry Stern; 17 Nov 2020, 14:05.

      Comment

      Working...
      X