*****************************************************************; *Program name: ohdfsis.sas *; *Reads: oral health exam, dental section OHXDENT, OHXDEN_B or combined dataset OHXDENAB *; *Writes: ohdfsis ohdfsisX *; *Does: Creates calculated fluorosis variables at the person level Dean's Fluorosis Index Mean Dean Score *; *Date: February 6, 2004 *; *Reviewed: May 25, 2005 *; *Revised: October 20, 2004 * *; * Nov 11 to create analysis variables with *; * no valid teeth present and cannot be assessed *; * set to missing *; * Dec 11 to add person-level Mean Dean Score *; * *; *Authors: *; * NIH/NIDCR - Robert Selwitz, Albert Kingman, Tianxia Wu, Richard Oldakowski *; * CDC/NCCDPHP - Susan Griffin, Eugenio Beltran, Laurie Barker *; * CDC/NCHS - Bruce Dye *; * Send comments or questions regarding this program to: Laurie Barker e-mail: LBarker@cdc.gov *****************************************************************; /* This program creates dataset OHDFSIS which includes SEQN and calculated variables: OHDMDS ="Mean Dean Score" OHDDFI ="Deans Fluorosis Index" It also creates dataset OHDFSISX which contains the same variables with the same names as OHDFSIS, except that special codes such as 9 for cannot be assessed are set to missing and variable names have an X added to the end. */ LIBNAME NHANESAB "K:/DOH/EVERYONE/NHANES/NHANES19992002/AnalysisFiles"; title1 "NHANES Fluorosis variables"; /*Select variables needed to create calculated fluorosis variable */ /*data step 1*/ data NHANESAB.ohdfsis; set NHANESAB.ohxdenAB; keep SEQN /* Keep variables for 28 teeth targeted for fluorosis assessment*/ ohx02di ohx03di ohx04di ohx05di ohx06di ohx07di ohx08di ohx09di ohx10di ohx11di ohx12di ohx13di ohx14di ohx15di ohx18di ohx19di ohx20di ohx21di ohx22di ohx23di ohx24di ohx25di ohx26di ohx27di ohx28di ohx29di ohx30di ohx31di ; run; /*Convert recorded Dean's Fluorosis scores to original Dean's Fluorosis scores (change code 5 to 0.5) Count teeth with valid scores, cannot be assessed, and missing data*/ /*data step 2*/ data NHANESAB.ohdfsis; set NHANESAB.ohdfsis; /*data step 2, section 1*/ /* Array variables for 28 teeth targeted for fluorosis assessment*/ array x[28] ohx02di ohx03di ohx04di ohx05di ohx06di ohx07di ohx08di ohx09di ohx10di ohx11di ohx12di ohx13di ohx14di ohx15di ohx18di ohx19di ohx20di ohx21di ohx22di ohx23di ohx24di ohx25di ohx26di ohx27di ohx28di ohx29di ohx30di ohx31di ; /*Create new variables to hold the original Dean's codes*/ array fsis[28]; /*data step 2, section 2*/ /*Initialize counters to zero for:*/ fsisvald=0; /*number of teeth with valid scores*/ fsiscant=0; /*number of teeth that cannot be assessed*/ fsismiss=0; /*number of teeth with missing data*/ do i=1 to 28; if x[i]=0 then do; fsis[i]=0; fsisvald+1; end; if x[i] in(1,2,3,4) then do; fsis[i]=x[i]; fsisvald+1; end; if x[i]=5 then do; fsis[i]=0.5; fsisvald+1; end; if x[i]=8 then do; fsis[i]= 0; fsisvald+1; end; if x[i]=9 then do; fsis[i]=.; fsiscant+1; end; if x[i]=. then do; fsis[i]=.; fsismiss+1; end; end; drop i; run; /*Mean Dean Score (MDS)*/ /*The MDS is an average of the Dean's Fluorosis scores.*/ /*This step calculates a mean score for each participant.*/ /*The variable fsisvald(number of teeth with valid Dean's Index scores) calculated in step 2 is used as the denominator for the person-level MDS. Participants with 1 or more teeth with a valid Dean's score will have an MDS value.*/ data NHANESAB.ohdfsis; /*Data step 3 - Mean Dean Score*/ set NHANESAB.ohdfsis; format OHDMDS 6.2; /*if fluorosis scores are missing set MDS to missing*/ if fsisvald=0 and fsismiss=28 then OHDMDS=.; /*If the only scores present are cannot be assessed, set MDS to 999 for cannot be assessed*/ else if fsisvald=0 and fsiscant>0 then OHDMDS=999; /*Calculate MDS*/ else if fsisvald>0 then OHDMDS=round((sum(of fsis1-fsis28)/fsisvald),.01); label OHDMDS ="Mean Dean Score" ; run; /* Dean's Fluorosis Index is the minimum score from the two teeth with the highest scores. To calculate the DFI, we first find the maximum score and store it in OHDDMX. We sum the fluorosis scores (stored as totf1). Then we set equal to 0 scores that are equal to the maximum score, and sum the remaining fluorosis scores (stored as totf2). If the difference between totf1 and totf2 is greater than the max, then at least two teeth had the same score as the maximum tooth, and the DFI is equal to the max. If the difference between totf1 and totf2 is equal to the maximum score, only 1 tooth had the maximum score, and the DFI is equal to the max of the remaining scores. */ data NHANESAB.ohdfsis;/*data step 4 Dean's Fluorosis Index*/ set NHANESAB.ohdfsis; OHDDMX=max(of fsis1-fsis28); /*Find maximum score and store it in OHDDMX*/ totf1=sum(of fsis1-fsis28); /*Sum the fluorosis scores*/ if totf1=. then e=1; /*create indicator e for observations missing fluorosis scores*/ array fsis[28]; /*array fluorosis scores*/ array fsisa{28]; /*create array to hold fluorosis scores with max set to 0*/ do i=1 to 28; if fsis[i] = OHDDMX then fsisa[i]=0; /*Set scores equal to the maximum to 0*/ else fsisa[i] = fsis[i]; end; drop i; run; data NHANESAB.ohdfsis; /*data step 5 - Dean's Fluorosis Index continued*/ set NHANESAB.ohdfsis; /*Sum of fluorosis scores after scores equal to the maximum are set to 0*/ totf2 =sum(of fsisa1-fsisa28); /*find difference between totf1 and totf2*/ diff =totf1-totf2; /*if fluorosis scores are missing set Dean's index to missing*/ if fsisvald=0 and fsismiss=28 then OHDDFI=.; /*If the only scores present are cannot be assessed, set Dean's Index to 9 for cannot be assessed*/ else if fsisvald=0 and fsiscant>0 then OHDDFI=9; /*if difference between totf1 and totf2 is greater than the maximum score then Dean's Fluorosis Index equals the maximum score*/ else if fsisvald>0 and diff > OHDDMX then OHDDFI=OHDDMX; /*else if the difference between totf1 and totf2 equals the maximum score Then Dean's Fluorosis Index equals the max of the remaining scores*/ else if fsisvald>0 then OHDDFI=max(of fsisa1-fsisa28); if OHDDFI in (.,0,0.5,1,2,3,9) then OHDDFIa=OHDDFI; else if OHDDFI=4 then OHDDFIa=3; label OHDDFI ="Deans Fluorosis Index" OHDDFIa ="Deans Fluorosis Index - moderate and severe combined" ; keep SEQN OHDDFI OHDDFIa OHDMDS ; run; /*Change cannot be assessed code of 9 or 999 to missing*/ /*data step 6*/ data NHANESAB.ohdfsisX; set NHANESAB.ohdfsis; if OHDDFI=9 then OHDDFIX=.; else OHDDFIX=OHDDFI; if OHDDFIa=9 then OHDDFIaX=.; else OHDDFIaX=OHDDFIa; if OHDMDS=999 then OHDMDSX=.; else OHDMDSX=OHDMDS; drop OHDDFI OHDDFIa OHDMDS; label OHDDFIX ="Deans Fluorosis Index - cannot be assessed set to . " OHDDFIaX ="Deans Fluorosis Index (mod and severe combined) - cannot be assessed set to . " OHDMDSX ="Mean Dean Score - cannot be assessed set to . " ; run; /*data step 7*/ /*Create categorical version of Deans Index*/ data NHANESAB.ohdfsisX; set NHANESAB.ohdfsisX; if OHDDFIX=0 then OHDDFISX=1; else if OHDDFIX=0.5 then OHDDFISX=2; else if OHDDFIX=1 then OHDDFISX=3; else if OHDDFIX=2 then OHDDFISX=4; else if OHDDFIX=3 then OHDDFISX=5; else if OHDDFIX=4 then OHDDFISX=6; if OHDDFIaX=0 then OHDDFIaSX=1; else if OHDDFIaX=0.5 then OHDDFIaSX=2; else if OHDDFIaX=1 then OHDDFIaSX=3; else if OHDDFIaX=2 then OHDDFIaSX=4; else if OHDDFIaX=3 then OHDDFIaSX=5; label OHDDFISX ="Deans Fluorosis Index (categories coded 1-6) - cannot be assessed set to . " OHDDFIaSX ="Deans Fluorosis Index (categories coded 1-5, mod/sev combined) - cannot be assessed set to . " ; run; /*Format for OHDDFI*/ /* To use formats, uncomment this section and move to beginning of program Add format statements to data steps or procs */ /* proc format; value ohddfi 0="DFI=None" 0.5="DFI=Questionable" 1="DFI=Very mild" 2="DFI=Mild" 3="DFI=Moderate" 4="DFI=Severe" 9="Cannot be assessed" ; value ohdmds 999="cannot be assessed" ; run; */ /*End ohdfsis.sas*/