/******************************************************************/ /* Title: CCS MENTAL HEALTH / SUBSTANCE ABUSE CATEGORIES */ /* INTEGRATION SOFTWARE, VERSION 3.0 */ /* */ /* PROGRAM: CCS-MHSA_INTEGRATION_O8.TXT */ /* */ /* Description: This program integrates the new CCS Mental Health */ /* and Substance Abuse (CCS-MHSA) categories into */ /* data containing original CCS categories. */ /* */ /* The program identifies the regular CCS categories */ /* for mental health, and using a SAS informat, */ /* replaces them with the new CCS-MHSA categories. */ /* Old CCS categories 65-75 are replaced with new */ /* categories 650-663 and 670. */ /* */ /* NOTE: Users will need to customize this program */ /* in certain places for their use. Please modify */ /* the macro variables at the beginning of this file */ /* and the CCS variable names at the end of the file.*/ /* */ /* Version: 3.0 - This version works with E Codes that are in */ /* a separate array from the diagnoses. It allows */ /* users to convert CCS categories containing the */ /* suicide E codes to the CCS-MHSA category 662 */ /* (suicide). This is useful for studies using HCUP */ /* data where the E codes are in a separate array. */ /* */ /* 2.0 - This version no longer excludes MHSA */ /* categories 662, 663 and suicide codes. */ /******************************************************************/ FILENAME INRAW 'C:\CCSMHSA\ccs-mhsa_general_08.csv'; * Modify the Path & name of CCS-MHSA General tool ; LIBNAME IN1 'C:\DATA\'; * Modify the location of input discharge data; LIBNAME OUT1 'C:\DATA\'; * Modify the location of output data; TITLE1 'INTEGRATION OF CCS MENTAL HEALTH/SUBSTANCE ABUSE CATEGORIES'; TITLE2 'USE WITH DISCHARGE ADMINISTRATIVE DATA THAT HAS ORIGINAL CCS CATEGORIES'; /*******************************************************************/ /* Macro Variables that must be set to define the characteristics */ /* of the input discharge data to the program */ /*******************************************************************/ * Enter the Maximum number of DXs on your SAS File; %LET NUMDX=15; * Are the E Codes on your file in a separate array, and if so,; * Do you want to integrate CCS-MHSA category 662 (suicide); * into the E Code array? (Y/N); %LET ECODE_="Y"; * Enter the Maximum number of E Codes if in a separate array; %LET NUMEX=4; * Enter Your SAS file name; %LET CORE=YOUR_SAS_FILE; * Are the CCS vars on your SAS file character? (Y/N); %LET CHAR_="N"; OPTIONS OBS = MAX MPRINT; %Macro Integrate; /*******************************************************************/ /* SAS Load the CCS-MHSA General Tool and use it to create a temp */ /* SAS informat that will be used to assign the new categories. */ /* Make an E code format to capture suicide E Codes. */ /*******************************************************************/ DATA INFORMAT; INFILE INRAW DSD DLM=',' END = EOF FIRSTOBS=3; INPUT START : $CHAR5. LABEL : $CHAR3. ; RETAIN HLO " "; %If &CHAR_ = "Y" or &CHAR_= "y" %then %do; FMTNAME = "$MHSA"; TYPE = "J"; %End; %Else %do; FMTNAME = "MHSA"; TYPE = "I"; %End; OUTPUT; IF EOF THEN DO; START = " "; LABEL = " "; HLO = "O"; OUTPUT; END; RUN; PROC FORMAT LIB=WORK CNTLIN = INFORMAT ; RUN; PROC FORMAT; VALUE $SUI 'E950 ' - 'E9599' = 1 OTHER = 0 ; RUN; /*******************************************************************/ /* Modify a dataset containing original CCS mental health */ /* categories by replacing them with the new CCS-MHSA categories. */ /* Run frequencies on CCS variables to see the new MHSA values. */ /* Original CCS categories are replaced by the new CCS-MHSA */ /* categories. */ /*******************************************************************/ DATA OUT1.INTEGRATION; SET IN1.&CORE; ARRAY DXS (*) $ DX1-DX&NUMDX; * Change diagnosis variable names to match your file; %if &ECODE_ = "Y" or &ECODE_ = "y" %then %do; ARRAY EXS (*) $ ECODE1-ECODE&NUMEX; * Change E code variable names to match your file; ARRAY ECCS (*) E_CCS1-E_CCS&NUMEX; * Change ECCS variable names to match your SAS file; %end; %if &CHAR_ = "Y" or &CHAR_ = "y" %then %do; ARRAY CCS (*) $ DXCCS1-DXCCS&NUMDX; * Change CCS variable names to match your SAS file; %end; %else %do; ARRAY CCS (*) DXCCS1-DXCCS&NUMDX; * Change CCS variable names to match your SAS file; %end; DO I = 1 TO &NUMDX; %if &CHAR_ = "Y" or &CHAR_ = "y" %then %do; IF ('65' <= CCS(I) <= '75') THEN CCS(I) = INPUT(DXS(I),$MHSA.); %end; %else %do; IF (65 <= CCS(I) <= 75) THEN CCS(I) = INPUT(DXS(I),MHSA.); %end; END; %if &ECODE_ = "Y" or &ECODE_ = "y" %then %do; DO I = 1 TO &NUMEX; IF PUT(EXS(I),$SUI.) = '1' THEN ECCS(I) = 662; END; %end; RUN; PROC FREQ DATA=OUT1.INTEGRATION; TABLES DXCCS1-DXCCS&NUMDX %if &ECODE_ = "Y" or &ECODE_ = "y" %then %do; E_CCS1-E_CCS&NUMEX %end; / MISSING LIST; * Change CCS variable names to match your file; TITLE3 'FREQUENCY OF CCS REPLACED WITH NEW CCS-MHSA CATEGORIES'; RUN; %Mend Integrate; %Integrate;