/*Previously Used Recodes*/ /*Code for previously used recodes that users can incorporate into programs - users can copy and paste relevant recodes into own programs as needed.*/ data recodes; /*EDUCATION*/ if 0 le dmq140 le 12 then educ=1; /*Less than High School*/ else if dmq140 in (13,14) then educ=2; /*High School/GED*/ else if 15 le dmq140 le 21 then educ=3; /*More than High School*/ /*MARITAL STATUS*/ if sfq180 = 5 then marstat=1; /*Never Married */ else if sfq180 in (1,6) then marstat=2; /*Married or Living with partner*/ else if sfq180 in (2,3,4) then marstat=3; /*Widowed, Divorced, or Separated*/ /*NATIVITY*/ /*US-Born (combining US and US Territories) vs Foreign-Born*/ if DMQ105 in (10, 11) or dmq111e in ('Virgin Islands (U.S.)') then US_Born=1; /*Born in US, Puerto Rico or Virgin Islands (no SPs born in Guam)*/ else if DMQ105 in (12, 13, 14, 15, 16, 66) then US_Born=2; /*Foreign-Born*/ /*US Born vs Foreign Born by length of time in US (<10 Years, 10+ Years)*/ if DMQ105 in (10, 11) or dmq111e in ('Virgin Islands (U.S.)') then for_born=1; /*Born in US, Puerto Rico or Virgin Islands (no SPs born in Guam)*/ else if DMQ105 in (12, 13, 14, 15, 16, 66) and 0<=US_time<10 then for_born=2; /*Foreign-Born in US <10 Yrs*/ else if DMQ105 in (12, 13, 14, 15, 16, 66) and US_time ge 10 then for_born=3; /*Foreign-Born in US 10+ Yrs*/ /*OCCUPATION*/ /*Recoding to 7 occupation groupings*/ if occrec in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) then occgrp = 1; /*Managerial and professional specialty*/ else if occrec in (23) then occgrp = 2; /*Sales*/ else if occrec in (24) then occgrp = 3; /*Technical and administrative*/ else if occrec in (17, 18, 19, 20, 22, 29) then occgrp = 4; /*Service*/ else if occrec in (25) then occgrp = 5; /*Farming, forestry, and fishing*/ else if occrec in (26, 27) then occgrp = 6; /*Precision production, craft, and repair*/ else if occrec in (28, 30, 31) then occgrp = 7; /*Operators, fabricators, and laborers*/ /*INSURANCE*/ /*General*/ if hiq012=1 then Insur=1; /*Insured*/ else if hiq012=2 then Insur=2; /*Uninsured*/ /*Comparable to Community Health Survey*/ if HIQ030 in (6,7,11) or HIQ200 in (6,7,11) then InsurCHS=1; /*Medicaid, CHIP, State- Sponsored (e.g., Family Plus)*/ else if HIQ030=4 or HIQ200=4 then InsurCHS=2; /*Medicare*/ else if HIQ030 in (1,2,3) or HIQ200 in (1,2,3) then InsurCHS=3; /*Private*/ else if HIQ030 in (5,8,9,10,12,13) or HIQ200 in (5,8,9,10,12,13) then InsurCHS=4; /*Other (however, no responses of 5 (Medi-gap) or 10 (Indian Health Service))*/ else if HIQ012=2 then InsurCHS=5; /*None*/ /*Type of insurance based on chronological determination using both types of insurance reported - 2 examples provided below*/ /*Private as first determination*/ if HIQ030 in (1,2,3,5,8,9,13) or HIQ200 in (1,2,3,5,8,9,13) then insur1=1; /*Private, Medi-gap(None), Military/VA, CHAMPUS/Tricare, Single Service Plan*/ else if HIQ030=4 or HIQ200=4 then insur1=2; /*Medicare*/ else if HIQ030 in (6,7,10,11,12) or HIQ200 in (6,7,10,11,12) then insur1=3; /*Medicaid, CHIP, Indian Health (N=0), State Spons, Other gov't*/ else if HIQ012=2 then insur1=4; /*None*/ /*Government (e.g., Medicaid) as first determination*/ if HIQ030 in (6,7,10,11,12) or HIQ200 in (6,7,10,11,12) then insur2=1; /*Medicaid, CHIP, Indian Health (None), State Spons, Other gov't*/ else if HIQ030=4 or HIQ200=4 then insur2=2; /*Medicare*/ else if HIQ030 in (1,2,3,5,8,9,13) or HIQ200 in (1,2,3,5,8,9,13) then insur2=3; /*Private, Medi-gap(None), Military/VA, CHAMPUS/Tricare, Single Service Plan*/ else if HIQ012=2 then insur2=4; /*None*/ /*ACCESS TO CARE*/ /*Routine place of care*/ if huq030 in (1,3) then rtnplace=1; /*1 or >1 place*/ if huq030=2 then rtnplace=2; /*No place*/ /*No place for routine care/type of place*/ if huq040 in (1,2,4,5) then rtnplce=1; /*Clinic or Health center, Doctor's office, Hosptial Outpatient, Some other place*/ if huq030=2 or huq040=3 then rtnplce=2; /*No place or ED*/ /*Type of place most often go - Of those with 1+ places to go for routine care [HUQ030]*/ if huq040=1 then typeplce=1; /*Clinic or Health center*/ if huq040=2 then typeplce=2; /*Doctor's office*/ if huq040 in (3,4,5) then typeplce=3; /*ER, Hosptial Outpatient, Some other place*/ /*INCOME*/ /* <$20,000, $20,000+ */ if inq640=2 then income=1; /*<$20,000*/ else if inq640=1 then income=2; /*$20,000+*/ /* <=$24,999 and $25,000+ */ if 'A' le inq650a le 'T' or 'U' le inq650b le 'Y' then income1=1; /*<=$24,999*/ else if inq650b='Z' or 'AA' le inq650b le 'RR' then income1=2; /*$25,000+*/ /* <=$24,999, $25,000-$49,999, and $50,000+ */ if 'A' le inq650a le 'T' or 'U' le inq650b le 'Y' then income2=1; /*<=$24,999*/ else if inq650b='Z' or 'AA' le inq650b le 'LL' then income2=2; /*$25,000-49,999*/ else if 'MM' le inq650b le 'RR' then income2=3; /*$50,000+*/ /*GENERAL HEALTH STATUS*/ if HUQ010 in (1,2,3) then genheal=1; /*Excellent, Very Good, Good*/ else if HUQ010 in (4,5) then genheal=2; /*Fair, Poor*/ /*SMOKING AND TOBACCO USE*/ /*Smoking Status (self-reported) - 3 categories*/ if smq020=2 then smoker=1; /*Never smoker*/ else if smq040 in (1,2) then smoker=2; /*Current*/ else if smq040=3 then smoker=3; /*Former*/ /*Smoking Status (self-reported) - 2 categories*/ if (smq020=2 or smq040=3) then smker = 1; /*Non-smoker*/ else if smq040 in (1,2) then smker = 2; /*Smoker*/ /*ETS Exposure @ Work*/ if smoker=1 and ocq152 in (1,2) and ocq290G=1 then ETS=1; /*ETS exposure @ work*/ else if smoker=1 and ocq152 in (1,2) and ocq290G=2 then ETS=2; /*No ETS exposure @ work*/ /*ALCOHOL USE*/ /*Heavy Drinking in past 12 months*/ /*Average more than 2 drinks per day for men*/ /*Average more than 1 drink per day for women*/ /* 1. Set Refused/DK, if any, to missing for how often drank and for avg # of drinks per day (for use in Heavy Drinking recode below)*/ if alq120g=9 then alq130=.; /*Cleaned - DK how often drank so cannot use # of drinks in recode*/ if alq130=999 then alq130=.; /*Recode to differentiate from true number response*/ /* 2. Calculate average # of drinks per day using following formula: drinks = (# of days drank) * (avg # of drinks on those days) / (# of days in reported unit)*/ if alq120u=1 then drinks=alq120q*alq130/7; /*based on # of days per week*/ if alq120u=2 then drinks=alq120q*alq130/30; /*based on # of days per month*/ if alq120u=3 then drinks=alq120q*alq130/365; /*based on # of days per year*/ /* 3. Determine Heavy Drinking - 2 Definitions*/ /*2 Categories: Heavy and Non-Heavy (wh/ includes non-drinkers*/ if riagendr=1 and drinks >2 then heavyalc=1; /*Men who drink an avg of >2.000000 drinks/day everyday*/ else if riagendr=2 and drinks >1 then heavyalc=1; /*Women who drink an avg of >1.000000 drink/day everyday*/ else if (riagendr=1 and 0<=drinks<=2) or (riagendr=2 and 0<=drinks<=1) or alq110=2 or alq120g=2 then heavyalc=2; /*Men and Women who drank less than the cut-off, never drink, or never drank in past 12 mos*/ /* OR */ /*3 Categories: Heavy Drinkers, Non-Heavy Drinkers, Non-Drinkers*/ if riagendr=1 and drinks >2 then heavyal2=1; /*Men who drink an avg of >2.000000 drinks/day everyday*/ else if riagendr=2 and drinks >1 then heavyal2=1; /*Women who drink an avg of >1.000000 drink/day everyday*/ else if (riagendr=1 and 0<=drinks<=2) or (riagendr=2 and 0<=drinks<=1) then heavyal2=2; /*Men and Women who drink but drank less than the heavy drinking cut-off*/ else if alq110=2 or alq120g=2 then heavyal2=3; /*Non-drinkers (drank less than 12 drinks in a year or in their entire life)*/ /*Binge Drinking in past 12 months (report of 5 or more drinks on one day) of those*/ /*Ever had 5 or more drinks on one day in the past 12 months*/ if alq140g=1 then binge=1; /*Ever binged in the past 12 months*/ else if alq140g=2 then binge=2; /*Never binged in the past 12 months*/ else if alq120g=2 or alq110=2 or alq140g=9 or alq140g=. then binge=.; /*Number of days SP had 5 or more drinks on one day in the past 12 months*/ if alq140g=1 & alq140u=1 then bingex=alq140q*52; /*based on # of days per week*/ else if alq140g=1 & alq140u=2 then bingex=alq140q*12; /*based on # of days per month*/ else if alq140g=1 & alq140u=3 then bingex=alq140q; /*based on # of days per year*/ else if alq140g=2 then binge=0; else if alq120g=2 or alq110=2 or alq140g=9 or alq140g=. then bingex=.; /*PHYSICAL ACTIVITY*/ /*VIGOROUS ACTIVITY - must do Steps 1-3 to obtain variable in #4 which is equivalent to the HP2010 Vigorous Activity goal*/ /* 1. Vigorous activity >=10 min in past 30 days*/ if paq206=1 then vigexer=1; /*Activity in the past 30 days*/ else if paq206=2 then vigexer=2; /*No activity in the past 30 days*/ else if paq206=3 then vigexer=3; /*Unable to do activity in the past 30 days*/ else if paq206 in (.,7,9) then vigexer=.; /* 2. # of times did vigorous activity PER WEEK (Continuous)*/ if vigexer=1 then do; if paq280u=1 then vigexfreq=paq280q*7; /*Convert # of times per day to #/wk*/ if paq280u=2 then vigexfreq=paq280q; /*Already in #/wk*/ if paq280u=3 then vigexfreq=paq280q/4; /*Convert # of times per month to #/wk*/ end; else if vigexer in (2,3) then vigexfreq=0; /*Did not do vigorous exercise therefore code as 0 times/wk*/ /* 3. Duration (in minutes) of vigorous activity PER INSTANCE (Continuous)*/ if vigexer=1 then do; if paq300u=1 then vigexamt=paq300q; /*Already in minutes*/ if paq300u=2 then vigexamt=paq300q*60; /*Convert hours to minutes*/ if vigexfreq=. then vigexamt=.; end; else if vigexer in (2,3)then vigexamt=0; /* 4. CREATE VARIABLE EQUIVALENT TO HP2010: At least 3 days/wk, 20 min each time - outliers of >=28 times/wk OR >= 720 min each time are taken into account in recode variables 'healthus' and 'active' below.*/ /* Three Categories: - HP2010 (At least 3 times/wk, 20 min each time) - Not HP2010 but some vigorous activity, and - No vigorous activity */ if (vigexamt >= 20) and (vigexfreq >= 3) then vigexhp=1; /*At least 3 times/wk X 20m*/ else if vigexamt > 0 and vigexfreq > 0 then vigexhp=2; /*Some vigorous activity*/ else if vigexer in (2,3) then vigexhp=3; /*No vigorous activity*/ else if paq206=. or (vigexamt=. and vigexfreq=.) then vigexhp=.; /*MODERATE ACTIVITY - must do Recodes 1-3 to obtain variable in #4 which is equivalent to the HP2010 Moderate Activity goal*/ /* 1. Moderate activity >=10 min in past 30 days*/ if paq326=1 then modexer=1; /*Activity in the past 30 days*/ else if paq326=2 then modexer=2; /*No activity in the past 30 days*/ else if paq326=3 then modexer=3; /*Unable to do activity in the past 30 days*/ else if paq326 in (.,7,9) then modexer=.; /* 2. # of times did moderate activity PER WEEK (Continuous) */ if modexer=1 then do; if paq400u=1 then modexfreq=paq400q*7; *Convert number of times per day to #/wk; if paq400u=2 then modexfreq=paq400q; *Already in #/wk; if paq400u=3 then modexfreq=paq400q/4; *Convert number of times per month to #/wk; end; else if modexer in (2,3) then modexfreq=0; /*Did not do moderate exercise therefore code as 0 times/wk*/ /* 3. Duration (in minutes) of moderate activity PER INSTANCE (Continuous) */ if modexer=1 then do; if paq420u=1 then modexamt=paq420q; /*Already in minutes*/ if paq420u=2 then modexamt=paq420q*60; /*Convert hours to minutes*/ if modexfreq=. then modexamt=.; end; else if modexer in (2,3) then modexamt=0; /* 4. CREATE VARIABLE EQUIVALENT TO HP2010: At least 5 days/wk, 30 min each time - outliers of >=28 times/wk OR >= 720 min each time are taken into account in recode variables 'healthus' and 'active' below.*/ /* Three Categories: - HP2010 (At least 5 times/wk, 30 min each time) - Not HP2010 but some moderate activity, and - No moderate activity */ if (modexamt >= 30) and (modexfreq >= 5) then modexhp=1; /*At least 5 times/wk X 30m*/ else if (modexamt > 0) and (modexfreq > 0) then modexhp=2; /*Some moderate activity */ else if modexer in (2,3) then modexhp=3; /*No moderate activity*/ else if (modexamt=. and modexfreq=.) or (paq326=.) then modexhp=.; /*NCHS - Health, US, 2005 Chartbook - must do above Vigorous Steps 1-4 AND Moderate Steps 1-4*/ if modexhp=1 or vigexhp=1 then healthus=1; /*Moderate HP2010 OR Vigorous HP2010*/ else if modexhp=2 or vigexhp=2 then healthus=2; /*Some Moderate OR Vigorous but not HP2010*/ else if modexhp=3 and vigexhp=3 then healthus=3; /*No Moderate AND No Vigorous*/ if modexfreq>=28 or vigexfreq>=28 or modexamt>=720 or vigexamt>=720 then healthus=.; /*Outliers*/ /*ACTIVE VS INACTIVE - must do above Vigorous Steps 1-4 AND Moderate Steps 1-4*/ if modexhp in (1,2) or vigexhp in (1,2) then active=1; /*Did any Moderate OR Vigorous Activity*/ else if modexhp=3 and vigexhp=3 then active=2; /*Did no Moderate OR Vigorous Activity*/ if modexfreq>=28 or vigexfreq>=28 or modexamt>=720 or vigexamt>=720 then active=.; /*Outliers*/ /*OBESITY - NOTE EXCLUSIONS*/ /*EXCLUSIONS*/ /*If OBESITY is primary analysis, consider excluding SPs with invalid or missing Height or Weight values as follows: if bmxht=. or bmiht=3 or bmxwt=. or bmiwt=4 then delete; /*Excludes SPs with invalid Height or Weight values.*/ /*Pregnant women are often exluded from obesity analyses (rhq142=1).*/ /*BMI 3 Categories - see Exclusions Note*/ if BMXBMI < 25 then BMI=1; /*Normal*/ else if 25 LE BMXBMI LT 30 THEN BMI=2; /*Overweight*/ else if BMXBMI ge 30 then BMI=3; /*Obese*/ /*BMI 4 Categories - see Excluions Note*/ if BMXBMI LT 18.5 then BMI2=1; /*Underweight*/ else if 18.5 LE BMXBMI LT 25 then BMI2=2; /*Normal*/ else if 25 LE BMXBMI LT 30 THEN BMI2=3; /*Overweight*/ else if BMXBMI ge 30 then BMI2=4; /*Obese*/ /*ABDOMINAL ADIPOSITY - NOTE EXCLUSIONS*/ /*EXCLUSIONS*/ /*If ABDOMINAL ADIPOSITY is primary analysis, consider excluding SPs with invalid or missing waist circumference values as follows: if bmxwaist=. then delete; /*Excludes SPs with invalid Waist Circumference values.*/ /*Pregnant women are often exluded from ABDOMINAL ADIPOSITY analyses (rhq142=1).*/ /*Waist Circumference*/ /*Men*/ if riagendr=1 then do; if 0 < bmxwaist le 102 then WC=1; /*Normal, Men*/ else if bmxwaist > 102 then WC=2; /*High, Men*/ end; /*Women*/ if riagendr=2 then do; if 0 < bmxwaist le 88 then WC=1; /*Normal, Women*/ else if bmxwaist > 88 then WC=2; /*High, Women*/ end; /*DIABETES - NOTE EXCLUSIONS*/ /*EXCLUSIONS*/ /*If TOTAL DIABETES is primary analysis, consider excluding SPs with invalid or missing responses to diq010 as follows: if diq010 in (.,7) then delete; /*When using fasting plasma glucose to define diabetes, you must use the fasting population.*/ /*Total Diabetes*/ if lbxglu ge 126 or diq010=1 then Dbts=1; /*Fasting Glucose >= 126 or Previously Diagnosed*/ else if lbxglu lt 126 and diq010 ne 1 then Dbts=2; /*Fasting Glucose <126 and Never told/ Refused/Missing in DIQ010*/ /*Self-Reported/Previously Diagnosed*/ if diq010=1 then SRDbts=1; /*Yes*/ else if diq010 in (2,3,9) then SRDbts=2; /*No, Borderline, DK*/ /*Undiagnosed among Diabetics*/ if Dbts=1 and diq010=1 then DxDbts=1; /*Previously Diagnosed*/ else if Dbts=1 and diq010 ne 1 then DxDbts=2; /*Undiagnosed*/ /*Undiagnosed among Total Population*/ if Dbts=1 and diq010=1 then DxDbts2=1; /*Previously Diagnosed*/ else if Dbts=1 and diq010 ne 1 then DxDbts2=2; /*Undiagnosed*/ else if Dbts ne 1 and diq010 ne 1 then dxdbts2=3; /*Non-Diabetic*/ /*HbA1c*/ if 0< lbxgh <7 then HbA1c=1; /*Controlled*/ else if lbxgh >=7 then HbA1c=2; /*Uncontrolled*/ /*HYPERTENSION - NOTE EXCLUSIONS*/ /*EXCLUSIONS*/ /*If HYPERTENSION is primary analysis, consider excluding SPs with invalid or missing hypertension interview data or blood pressure examination values as follows: if bpq010 in (.,7) or bpxsar in (.,0) or bpxdar in (.) then delete;*/ /*Hypertension*/ if BPXSAR GE 140 or BPXDAR GE 90 or BPQ051a=1 then HTN=1; /*Hypertensive if SBP>=140 OR DBP>=90 OR Taking Prescribed Medication for Hypertension*/ else HTN=2; /*Non-Hypertensive - Do not need to specify all values since no Missing/Ref as per EXCLUSION step.*/ /*Awareness/Undiagnosed HTN*/ if HTN=1 and BPQ020=1 then DxHTN=1; else if HTN=1 and bpq020 ne 1 then DxHTN=2; /*missing for BPQ020 is included since represent SPs who skip out due to No/DK response to BPQ010 - no SP was a 'true' missing to BPQ020 (e.g., answered Yes to being screened but didn't provide response to awareness)*/ /*Treated HTN*/ if HTN=1 and bpq051a=1 then HTNtx=1; else if HTN=1 and bpq051a ne 1 then HTNtx=2; /*Do not need to specify all categories if subsetting to those with complete interview/exam in which case skip patterns are correct.*/ /*Controlled HTN*/ /*In assessing control among Hypertensives: Because Hypertensives = SPs on Meds + Undiagnosed SPs (ie, HTN = Measurement or Meds), only Treated Hypertensives could potentially be controlled since undiagnosed could only be identified based on a high ('non-controlled') value*/ if HTN=1 and HTNtx=1 and BPXSAR <140 and BPXDAR < 90 then HTNCont=1; else if HTN=1 then HTNCont=2; /*Do not need to specify all categories if subsetting to those with complete interview/exam in which case skip patterns are correct.*/ /*HYPERCHOLESTEROLEMIA - NOTE EXCLUSIONS*/ /*EXCLUSIONS*/ /*If HYPERCHOLESTEROLEMIA is primary analysis, consider excluding SPs with invalid or missing high cholesterol interview data or examination values as follows: if bpq060 in (.,7) or lbxtc in (.) then delete;*/ /*Hypercholesterolemia (240 mg/dL cut-off) - Measurement + Meds*/ IF LBXTC GE 240 or BPQ100d=1 THEN HCL=1; /*Hypercholesterolemic if Total Cholesterol>=240 OR Taking Prescribed Cholesterol-Lowering Medication*/ else HCL=2; /*Do not need to specify all values since no Missing/Refused as per EXCLUSION step.*/ /*Awareness/Undiagnosed Hypercholesterolemia*/ if HCL=1 and BPQ080=1 then DxHCL=1; else if HCL=1 and bpq080 ne 1 then DxHCL=2; /*missing for BPQ080 is included since represent SPs who skip out due to No/DK response to BPQ060 - no SP was a 'true' missing to BPQ080 (e.g., answered Yes to being screened but didn't provide response to awareness)*/ /*Treated HCL*/ if HCL=1 and bpq100d=1 then HCLtx=1; else if HCL=1 and bpq100d ne 1 then HCLtx=2; /*Do not need to specify all categories if subsetting to those with complete interview/exam in which case skip patterns are correct.*/ /*LDL - Calculated using Friedewald equation*/ /*Friedewald Formula: LDL-C = TC HDL-C (TG/5) */ /*Related Measures: LDL = Total Cholesterol - HDL - (Triglycerides/5) */ /*TG/5 represents VLDL-C (very low-density lipoprotein cholesterol)*/ /*Calculated only for fasting population because measure based on fasting triglycerides*/ /*Triglycerides must be between 0 and 400 mg/dL*/ if wtsf1f >0 and (0< LBXTR < 400) then LDL = LBXTC - LBXHDD - (LBXTR/5); /*COLONOSCOPY SCREENING - NOTE THAT ONLY SPs AGES 50+ ARE ASKED QUESTIONS*/ /*Colonoscopy Exam*/ if mcq480 in (1,3) then col=1; /*Received colonoscopy*/ else if mcq470=2 or mcq480=2 then col=2; /*Did not receive colonoscopy*/ /*Colonoscopy in Past 10 Years*/ if mcq490 in (1,2,3) then colon10=1; /* <=10 Years */ else colon10=2; /* >10 Years */ /*EXAMPLE OF 'G,Q,U' VARIABLE RECODE - How often eat fresh fruits*/ /*Code responses of 'Never' to 0*/ if dbq107g=2 then dbq107=0; /*Standardize units to # of times per day ate fresh fruits*/ else if dbq107u=1 then dbq107=dbq107q; else if dbq107u=2 then dbq107=round(dbq107q/7,1); else if dbq107u=3 then dbq107=round(dbq107q/30,1); else if dbq107u=4 then dbq107=round(dbq107q/365,1); /*NUMBER OF LIFETIME SEX PARTNERS - only asked of those who reported 'Yes' to 'ever had sex' in SXQ020. Those who reported 'No' to 'ever had sex' [SXQ020=2] would be recoded as having 0 lifetime sex partners if needed in analysis.*/ /* 1. # of Lifetime Sex Partners for Women */ if sxq100 in (.,77777,99999) or sxq130 in (.,77777,99999) then life_women=.; else life_women=sxq100+sxq130; /* 2. # of Lifetime Sex Partners for Men */ if sxq170 in (.,77777,99999) or sxq200 in (.,77777,99999) then life_men=.; else life_men=sxq170+sxq200; /* 3. If Analyst prefers one variable for Total # of Lifetime Sex Partners (i.e., regardless of gender of sex partners, create ), can do: */ if riagendr = 1 then lifetime=life_men; if riagendr = 2 then lifetime=life_women; /* 4. Collapse into Categories - NOTE: /* A. Missing/Refused/Don't Knows - Analyst can determine categories, but if using lifetime sex partner variable from #3 above, should also consider how to treat missing/Ref/DKs. For example, SP may have reported 4 female lifetime sex partners and Ref/DK # of male lifetime sex partners. If analyst is reporting a category of 1-4 total lifetime sex partners, this SP should not be counted as such, but would fall out as missing or could be categorized as missing/Ref/DK. However, if analyst is reporting a category of 4+ total lifetime sex partners, this SP could be counted as having 4+ partners since we know for certain that this SP had at least 4 lifetime sex partners. /* B. As stated above, questions related to # of lifetime sex partners are only asked of those who had reported yes to 'ever had sex' in SXQ020. Therefore, those who reported no to 'ever had sex' [SXQ020=2] would be recoded as having 0 lifetime sex partners if needed in analysis. /* C. The following code is an EXAMPLE for recoding Total # of Lifetime Sex Partners into categories of 1, 2-5, 6-10 and >10 partners after creating recodes in Steps 1-3 above: */ if lifetime=1 then LTpart=1; /* 1 */ else if 2 le lifetime le 5 then LTpart=2; /* 2-5 */ else if 6 le lifetime le 10 then LTpart=3; /* 6-10 */ else if lifetime > 10 then LTpart=4; /* >10 */ else if lifetime=. then do; if sxq100 in (77777,99999) and sxq130 in (77777,99999) then LTpart=.; /*Women Ref/DK 3 of lifetime male and lifetime female partners*/ else if sxq170 in (77777,99999) and sxq200 in (77777,99999) then LTpart=.; /*Men Ref/DK # of lifetime female and lifetime male partners*/ else if sxq100 in (.,77777,99999) and sxq130 > 10 then LTpart=4; /*Women Ref/DK # of lifetime male partners but had >10 lifetime female partners*/ else if sxq130 in (.,77777,99999) and sxq100 > 10 then LTpart=4; /*Women Ref/DK # of lifetime female partners but had >10 lifetime male partners*/ else if sxq170 in (.,77777,99999) and sxq200 > 10 then LTpart=4; /*Men Ref/DK # of lifetime female partners but had >10 lifetime male partners*/ else if sxq200 in (.,77777,99999) and sxq170 > 10 then LTpart=4; /*Men Ref/DK # of lifetime male partners but had >10 lifetime female partners*/ end; /*MSM*/ if sxq200 notin (.,77777,99999) then do; /*Cannot determine MSM for Missing/Ref/DK*/ if sxq200>0 then MSM=1; else if sxq200=0 then MSM=2; end; /*Ever Needle Use*/ if duq100 notin (.,7,9) then do; /*Limit Drug Use recodes to SPs who were not missing/Ref/DK for the initial questions to Drug Use section*/ if duq120=1 then needle=1; else if duq100=2 or duq120=2 then needle=2; end;