I use the following function that I wrote and I send the following from data displays, "UM" for Untreated Score for Male, "TM" for Treated Score for Male, "UF" for Untreated Score for Female, and "TF" for Treated Score for Female.
fn fnCV_RC(CVGender)
{
local CVPoints=0
local CVStr=""
cond
case CVGender == "UM" or CVGender == "TM"
cond
case PATIENT_AGE() >= "20" and PATIENT_AGE() < "35"
CVPoints=-9
case PATIENT_AGE() >= "35" and PATIENT_AGE() < "40"
CVPoints=-4
case PATIENT_AGE() >= "40" and PATIENT_AGE() < "45"
CVPoints=0
case PATIENT_AGE() >= "45" and PATIENT_AGE() < "50"
CVPoints=3
case PATIENT_AGE() >= "50" and PATIENT_AGE() < "55"
CVPoints=6
case PATIENT_AGE() >= "55" and PATIENT_AGE() < "60"
CVPoints=8
case PATIENT_AGE() >= "60" and PATIENT_AGE() < "65"
CVPoints=10
case PATIENT_AGE() >= "65" and PATIENT_AGE() < "70"
CVPoints=11
case PATIENT_AGE() >= "70" and PATIENT_AGE() < "75"
CVPoints=12
case PATIENT_AGE() >= "75" and PATIENT_AGE() < "80"
CVPoints=13
else "" endcond
cond
case obsany("CHOLESTEROL") < 160
CVPoints=CVPoints
case obsany("CHOLESTEROL") >= 160 and obsany("CHOLESTEROL") < 200
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+4
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+3
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+2
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+1
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints
else "" endcond
case obsany("CHOLESTEROL") >= 200 and obsany("CHOLESTEROL") < 240
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+7
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+5
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+3
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+1
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints
else "" endcond
case obsany("CHOLESTEROL") >= 240 and obsany("CHOLESTEROL") < 280
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+9
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+6
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+4
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+2
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
case obsany("CHOLESTEROL") >= 280
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+11
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+8
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+5
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+3
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
else "" endcond
cond
case obsany("SMOK STATUS") == "current some day smoker" or obsany("SMOK STATUS") == "current every day smoker" or obsany("SMOK STATUS") == "smoker - current status unknown" or obsany("SMOK STATUS") == "Current"
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+8
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+5
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+3
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+1
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
else "" endcond
cond
case obsany("HDL") = ""
CVPoints=CVPoints
case obsany("HDL") >= 60
CVPoints=CVPoints-1
case obsany("HDL") >= 50 and obsany("HDL") < 60
CVPoints=CVPoints
case obsany("HDL") >= 40 and obsany("HDL") < 50
CVPoints=CVPoints+1
case obsany("HDL") < 40
CVPoints=CVPoints+2
else "" endcond
case CVGender == "UF" or CVGender == "TF"
cond
case PATIENT_AGE() >= "20" and PATIENT_AGE() < "35"
CVPoints=-7
case PATIENT_AGE() >= "35" and PATIENT_AGE() < "40"
CVPoints=-3
case PATIENT_AGE() >= "40" and PATIENT_AGE() < "45"
CVPoints=0
case PATIENT_AGE() >= "45" and PATIENT_AGE() < "50"
CVPoints=3
case PATIENT_AGE() >= "50" and PATIENT_AGE() < "55"
CVPoints=6
case PATIENT_AGE() >= "55" and PATIENT_AGE() < "60"
CVPoints=8
case PATIENT_AGE() >= "60" and PATIENT_AGE() < "65"
CVPoints=10
case PATIENT_AGE() >= "65" and PATIENT_AGE() < "70"
CVPoints=12
case PATIENT_AGE() >= "70" and PATIENT_AGE() < "75"
CVPoints=14
case PATIENT_AGE() >= "75" and PATIENT_AGE() < "80"
CVPoints=16
else "" endcond
cond
case obsany("CHOLESTEROL") < 160
CVPoints=CVPoints
case obsany("CHOLESTEROL") >= 160 and obsany("CHOLESTEROL") < 200
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+4
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+3
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+2
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+1
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
case obsany("CHOLESTEROL") >= 200 and obsany("CHOLESTEROL") < 240
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+8
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+6
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+4
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+2
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
case obsany("CHOLESTEROL") >= 240 and obsany("CHOLESTEROL") < 280
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+11
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+8
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+5
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+3
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+2
else "" endcond
case obsany("CHOLESTEROL") >= 280
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+13
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+10
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+7
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+4
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+2
else "" endcond
else "" endcond
cond
case obsany("SMOK STATUS") == "current some day smoker" or obsany("SMOK STATUS") == "current every day smoker" or obsany("SMOK STATUS") == "smoker - current status unknown" or obsany("SMOK STATUS") == "Current"
cond
case PATIENT_AGE() >= 20 and PATIENT_AGE() < 40
CVPoints=CVPoints+9
case PATIENT_AGE() >= 40 and PATIENT_AGE() < 50
CVPoints=CVPoints+7
case PATIENT_AGE() >= 50 and PATIENT_AGE() < 60
CVPoints=CVPoints+4
case PATIENT_AGE() >= 60 and PATIENT_AGE() < 70
CVPoints=CVPoints+2
case PATIENT_AGE() >= 70 and PATIENT_AGE() < 80
CVPoints=CVPoints+1
else "" endcond
else "" endcond
cond
case obsany("HDL") = ""
CVPoints=CVPoints
case obsany("HDL") >= 60
CVPoints=CVPoints-1
case obsany("HDL") >= 50 and obsany("HDL") < 60
CVPoints=CVPoints
case obsany("HDL") >= 40 and obsany("HDL") < 50
CVPoints=CVPoints+1
case obsany("HDL") < 40
CVPoints=CVPoints+2
else "" endcond
else "" endcond
cond
case CVGender == "UM"
cond
case obsany("BP SYSTOLIC") < 130
CVPoints=CVPoints
case obsany("BP SYSTOLIC") >= 130 and obsany("BP SYSTOLIC") < 160
CVPoints=CVPoints+1
case obsany("BP SYSTOLIC") >= 160
CVPoints=CVPoints+2
else "" endcond
case CVGender == "TM"
cond
case obsany("BP SYSTOLIC") < 120
CVPoints=CVPoints
case obsany("BP SYSTOLIC") >= 120 and obsany("BP SYSTOLIC") < 130
CVPoints=CVPoints+1
case obsany("BP SYSTOLIC") >= 130 and obsany("BP SYSTOLIC") < 160
CVPoints=CVPoints+2
case obsany("BP SYSTOLIC") >= 160
CVPoints=CVPoints+3
else "" endcond
case CVGender == "UF"
cond
case obsany("BP SYSTOLIC") < 120
CVPoints=CVPoints
case obsany("BP SYSTOLIC") >= 120 and obsany("BP SYSTOLIC") < 130
CVPoints=CVPoints+1
case obsany("BP SYSTOLIC") >= 130 and obsany("BP SYSTOLIC") < 140
CVPoints=CVPoints+2
case obsany("BP SYSTOLIC") >= 140 and obsany("BP SYSTOLIC") < 160
CVPoints=CVPoints+3
case obsany("BP SYSTOLIC") >= 160
CVPoints=CVPoints+4
else "" endcond
case CVGender == "TF"
cond
case obsany("BP SYSTOLIC") < 120
CVPoints=CVPoints
case obsany("BP SYSTOLIC") >= 120 and obsany("BP SYSTOLIC") < 130
CVPoints=CVPoints+3
case obsany("BP SYSTOLIC") >= 130 and obsany("BP SYSTOLIC") < 140
CVPoints=CVPoints+4
case obsany("BP SYSTOLIC") >= 140 and obsany("BP SYSTOLIC") < 160
CVPoints=CVPoints+5
case obsany("BP SYSTOLIC") >= 160
CVPoints=CVPoints+6
else "" endcond
else "" endcond
cond
case CVGender == "UM" or CVGender == "TM"
cond
case CVPoints < 0
CVStr=" < 1%"
case CVPoints >= 0 and CVPoints < 5
CVStr=" 1%"
case CVPoints >= 5 and CVPoints < 7
CVStr=" 2%"
case CVPoints = 7
CVStr=" 3%"
case CVPoints = 8
CVStr=" 4%"
case CVPoints = 9
CVStr=" 5%"
case CVPoints = 10
CVStr=" 6%"
case CVPoints = 11
CVStr=" 8%"
case CVPoints = 12
CVStr=" 10%"
case CVPoints = 13
CVStr=" 12%"
case CVPoints = 14
CVStr=" 16%"
case CVPoints = 15
CVStr=" 20%"
case CVPoints = 16
CVStr=" 25%"
case CVPoints >= 17
CVStr=" 30%"
else "" endcond
case CVGender == "UF" or CVGender == "TF"
cond
case CVPoints < 9
CVStr=" < 1%"
case CVPoints >= 9 and CVPoints < 13
CVStr=" 1%"
case CVPoints >= 13 and CVPoints < 15
CVStr=" 2%"
case CVPoints = 15
CVStr=" 3%"
case CVPoints = 16
CVStr=" 4%"
case CVPoints = 17
CVStr=" 5%"
case CVPoints = 18
CVStr=" 6%"
case CVPoints = 19
CVStr=" 8%"
case CVPoints = 20
CVStr=" 11%"
case CVPoints = 21
CVStr=" 14%"
case CVPoints = 22
CVStr=" 17%"
case CVPoints = 23
CVStr=" 22%"
case CVPoints = 24
CVStr=" 27%"
case CVPoints >= 25
CVStr=" 30%"
else "" endcond
else "" endcond
return CVStr
}