Solved
New Contributor
Posts: 2

# Meeting 3 of the 5 criteria

Hi!

I am trying to find a SAS code that would allow me to identify participants who have metabolic syndrome, which is defined by having at least three of the five following criteria [(1) triglyceride level ≥ 150 mg/dL; (2) high-density lipoprotein cholesterol < 40 mg/dL for men and < 50 mg/dL for women; (3) systolic blood pressure ≥ 130 mmHg or diastolic blood pressure ≥ 85 mmHg; (4) fasting glucose level ≥ 110 mg/dL; and (5) BMI > 30 kg/m2].

I know how to do the simple "If then" code but I don't know which SAS code that would allow me to identify individuals with 3 or more of the listed criteria (in any combination) automatically instead of having to write all the combinations manually.

Accepted Solutions
Solution
‎06-29-2015 02:47 PM
Super User
Posts: 6,785

## Re: Meeting 3 of the 5 criteria

Simplest might be to count the number of conditions met, such as:

n_symptoms = (triglyceride >= 150) + (systolic >= 130 or diastolic >= 85) + (glucose >= 110) + (BMI > 30);

if gender='M' then n_symptoms = n_symptoms + (HDL < 40);

else if gender='F' then n_symptoms = n_symptoms + (HDL < 50);

Each comparison generates a 1 (for true comparisons) or a 0 (for false comparisons).

You might need to adjust this for the variable names/values, but that's the general idea.  It would be easy after that to use N_SYMPTOMS in subsequent processing.

Good luck.

All Replies
Valued Guide
Posts: 864

## Re: Meeting 3 of the 5 criteria

Can you add a few rows of data?  There are going to be several ways to do this depending on how the data is stored.  Also; if you add what you have AND what the output should look like that will be even more helpful.

Solution
‎06-29-2015 02:47 PM
Super User
Posts: 6,785

## Re: Meeting 3 of the 5 criteria

Simplest might be to count the number of conditions met, such as:

n_symptoms = (triglyceride >= 150) + (systolic >= 130 or diastolic >= 85) + (glucose >= 110) + (BMI > 30);

if gender='M' then n_symptoms = n_symptoms + (HDL < 40);

else if gender='F' then n_symptoms = n_symptoms + (HDL < 50);

Each comparison generates a 1 (for true comparisons) or a 0 (for false comparisons).

You might need to adjust this for the variable names/values, but that's the general idea.  It would be easy after that to use N_SYMPTOMS in subsequent processing.

Good luck.

Posts: 3,167

## Re: Meeting 3 of the 5 criteria

By the same token, everything maybe canned into one expression:

n_symptoms = (triglyceride >= 150) + (systolic >= 130 or diastolic >= 85) + (glucose >= 110) + (BMI > 30)

+ (gender='M'  and HDL < 40)

+ ( gender='F'  and HDL < 50);

New Contributor
Posts: 2

## Re: Meeting 3 of the 5 criteria

Thank you so much for your help!! I really appreciate it! It worked!

🔒 This topic is solved and locked.