/*=============================================================== * File: PSI_Comp.SAS * Title: MONAHRQ Utility Files for SAS; * * Description:; * Reformats the SAS QI to WinQI style output; * for PSI Composite level QIs * * Prepared by Truven Health Analytics; * * VERSION 1.0, AUGUST 2012; * *===============================================================*/ options ls=120 ps=55 nocenter ; FILENAME CONTROL 'C:\PATHNAME\CONTROL_PSI.SAS'; *<===USER MUST modify; %include control ; %let pgm_=PSI_Comp; *---------------------------------*; * get the variable names from the *; * output SAS data set produced by *; * SAS qi *; *---------------------------------*; proc contents data=outp3.PSc3 noprint out=PSc3Vars ; run ; proc print data=PSc3Vars ; var name label ; title3 "output from proc contents on PSc3 data set" ; run ; *-------------------------------------*; * Create output data set for Laurie *; *-------------------------------------*; proc format ; value hospid (default=20) .='TOTAL' ; *26Jul12-bump max output field to 20; run ; *-----------------------------*; * 25Jul12tak: bump length of *; * hospid to 20, keep key to *; * sort TOTAL to bottom of *; * hospid within QI *; *-----------------------------*; Data PSI_C3(rename=(charhospid=hospID)) ; length composite_name $ 8 charhospid $20 ; keep composite_name charhospid comp compvar compse compwht compLB compUB hospKey ; set outp3.PSc3(keep=hospid comp1 comp1var comp1se comp1wht comp1LB comp1UB) ; charhospid=put(hospid,hospid.) ; HospKey=hospid ; *25Jul12tak, add sort key; label composite_name='composite_name' charhospid='Hospital ID' comp='COMP1' compvar='COMP1VAR' compse='COMP1SE' compwht='COMP1WHT' compLB='COMP1LB' compUB='COMP1UB' ; comp=comp1 ; compvar=comp1var ; compse=comp1se ; compwht=comp1wht ; complb=comp1lb ; compub=comp1ub ; composite_name='PSI Comp' ; * PSI90, Mortality for selected procedures; output ; run ; proc sort data=PSI_C3 ; by descending composite_name descending hospKey ; *25Jul12, new sort ; run ; proc print data=PSI_C3 noobs ; id composite_name hospid ; title3 "New version of C3 output from Battelle SAS QI" ; run ; *-------------------------------------*; * Output to csv file. Hack proc Export*; * from version 9.2, which supports *; * labels. *; *-------------------------------------*; %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ %let _EFIREC_ = 0; /* clear export record count macro variable */ data _null_; file "&pgm_._PSI_C3.csv" delimiter=',' DSD DROPOVER lrecl=32767; if _n_ = 1 then do; /* write column names or labels */ put "composite_name" ',' "Hospital ID" ',' "COMP1" ',' "COMP1VAR" ',' "COMP1SE" ',' "COMP1WHT" ',' "COMP1LB" ',' "COMP1UB" ; end; set PSI_C3 end=EFIEOD; format composite_name $8. ; format hospID $20. ; *25Jul12tak: bump lenght ; format comp best12. ; format compvar best12. ; format compse best12. ; format compwht best12. ; format compLB best12. ; format compUB best12. ; do; EFIOUT + 1; put composite_name $ @; put hospID $ @; put comp @; put compvar @; put compse @; put compwht @; put compLB @; put compUB ; ; end; if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */ if EFIEOD then call symputx('_EFIREC_',EFIOUT); run; /**//****************************//**/