MFA Scoring Program SAS Program: SAS.txt options ps=60 ls=80; run; proc dbf db4in='a:\testdata.dbf' out=c.test; run; data c.test2; set c.test; * reverse coding for these questions; move4 = floor(1/(move4+1)); move5 = floor(1/(move5+1)); move6 = floor(1/(move6+1)); move7 = floor(1/(move7+1)); move10 = floor(1/(move10+1)); move16 = floor(1/(move16+1)); move17 = floor(1/(move17+1)); move18 = floor(1/(move18+1)); home2 = floor(1/(home2+1)); home4 = floor(1/(home4+1)); emot5 = floor(1/(emot5+1)); emot6 = floor(1/(emot6+1)); emot7 = floor(1/(emot7+1)); * recode anything other than 0 or 1 to 0; array move{20}; do I =1 to 20; if move{i} not in (0,1) then move{i} = 0; end; array fine{7}; do I =1 to 7; if fine{i} not in (0,1) then fine{i} = 0; end; array home{9}; do I =1 to 9; if home{i} not in (0,1) then home{i} = 0; end; array adl{18}; do I =1 to 18; if adl{i} not in (0,1) then adl{i} = 0; end; array sleep{6}; do I =1 to 6; if sleep{i} not in (0,1) then sleep{i} = 0; end; MFA Scoring Program for SAS - Page 2 * recode anything other than 0 or 1 to 0 (CONTINUED); array leis{4}; do I =1 to 4; if leis{i} not in (0,1) then leis{i} = 0; end; array relat{10}; do I =1 to 10; if relat{i} not in (0,1) then relat{i} = 0; end; array cog{4}; do I =1 to 4; if cog{i} not in (0,1) then cog{i} = 0; end; array emot{18}; do I =1 to 18; if emot{i} not in (0,1) then emot{i} = 0; end; array job{4}; do I =1 to 4; if job{i} not in (0,1) then job{i} = 0; end; * recode jobr; if jobyn = 0 then do; if jobhlth = 1 then jobr = 5; else jobr = 1; end; * assign defaults for these items; if move1 = 0 then do; move2 = 1; move6 = 1; move7 = 1; move8 = 1; move9 = 1; move10 = 1; move12 = 1; move13 = 1; move18 = 1; end; if jobhlth = 1 then do; job1=1; job2=1; job3=1; job4=1; end; run; MFA Scoring Program for SAS - Page 3 data c.test3; set c.test2 (drop=i); * calculate raw category scores (sums); moveraw = sum(of move1-move20); fineraw = sum(of fine1-fine7); homeraw = sum(of home1-home9); adlraw = sum(of adl1-adl18); slepraw = sum(of sleep1-sleep6); leiraw = sum(of leis1-leis4); relaraw = sum(of relat1-relat10); cograw = sum(of cog1-cog4); emotraw = sum(of emot1-emot18); jobraw = sum(of job1-job4); * calculate raw MFA score; totraw = sum(of moveraw -- jobraw); * calculate standardized category scores; movestd = round(moveraw/20*100,.01); finestd = round(fineraw/7*100,.01); homestd = round(homeraw/9*100,.01); adlstd = round(adlraw/18*100,.01); slepstd = round(slepraw/6*100,.01); leistd = round(leiraw/4*100,.01); relastd = round(relaraw/10*100,.01); cogstd = round(cograw/4*100,.01); emotstd = round(emotraw/18*100,.01); jobstd = round(jobraw/4*100,.01); * calculate total MFA score; MFASCORE = totraw; *identify missing in patient self-rating questions array pat{10} mover finer homer adlr sleepr leisr relatr cogr emotr jobr; do i=1 to 10; if pat{i} in (7,8,9) then pat{i} = .; end; *calculate patient rating score; PRSCORE = (mover + finer + homer + adlr + sleepr + leisr + relatr + cogr + emotr + jobr)/10; run; proc means data=c.test3; * var movescr2 -- mfascr2; var patscore; run; c:\mfa-L1.0\sas.doc