/************************************************************************/ /* */ /* Title: trauma_estimate.sas */ /* Author: S. Goble, Statitician NTDB */ /* Project: National Sample Project (NSP) */ /* */ /* Purpose: Create statistical estimates for valid trauma cases, */ /* excluding hip fractures, analyzing the weighted data */ /* taking into account the sample design. */ /* */ /* Input data: 1. The final weights and Strata indicators */ /* for each incident */ /* Name: Weights */ /* Variables needed: Name: */ /* Incident ID INC_KEY */ /* Facility ID FAC_KEY */ /* Strata STRATA */ /* Weights WEIGHTS */ /* */ /* 2. Information pertaining to a diagnosis */ /* made about the trauma incident. */ /* Name: Diagnosis */ /* Variables needed: Name: */ /* Incident ID INC_KEY */ /* Diagnosis code DCODE */ /* */ /* 3. Includes information about the patient */ /* and incident demographics. */ /* Name: Demo */ /* Variables needed: Name: */ /* Incident ID INC_KEY */ /* Age AGE */ /* Gender GENDER */ /* Race RACE */ /* */ /* 4. Includes information pertaining to the outcome */ /* of the trauma incident. */ /* Name: Outcome */ /* Variables needed: Name: */ /* Incident ID INC_KEY */ /* Discharge status DISSTATUS */ /* Hospital lengt of stay LOS */ /* ICU length of stay ICU day */ /* */ /* Output: Frequency estimate of gender, race and discharge status */ /* Mean estimate of Age, LOS and ICU days */ /* */ /* Created: April, 2007 */ /* */ /* **There are 8 weighting strata that are combinations of */ /* 4 Census regions and 2 designated levels of trauma care */ /* level I or level II. (non-ntdb data not available for 2003 data) */ /************************************************************************/ * Change the following: 'D:\data\NSP\Files_sent_out\Data_Sets' to '\yourpathname\'; /*folder for saving input and output Data_Sets*/ *** Import the weights ***; PROC IMPORT FILE="D:\data\NSP\Files_sent_out\Data_Sets\Weights.csv" OUT=WT2003 DBMS=csv REPLACE; GETNAMES=YES; RUN; **** GET THE VALID TRAUMA CODES ***; PROC IMPORT DATAFILE="D:\data\NSP\Files_sent_out\Data_Sets\DIAGNOS.csv" OUT=DIAGNOS DBMS=csv REPLACE; GETNAMES=YES; RUN; *** GET ONLY THE VALID TRAUMA RECORDS ***; DATA DIAGNOS; SET DIAGNOS; IF 800<=DCODE<960; IF 905<=DCODE<910 THEN DELETE; IF 910<=DCODE<925 THEN DELETE; IF 930<=DCODE<940 THEN DELETE; KEEP INC_KEY DCODE; RUN; ***** EXCLUDE CASES WITH HIP-FRACTURE ****; DATA DIAGNOS; SET DIAGNOS; IF 820<=DCODE<=820.9 THEN DELETE; RUN; ***** DEMOGRAPHICS ****; PROC IMPORT DATAFILE="D:\data\NSP\Files_sent_out\Data_Sets\DEMO.csv" OUT=DEMO DBMS=csv REPLACE; GETNAMES=YES; RUN; **** OUTCOME DATA *****; PROC IMPORT DATAFILE="D:\data\NSP\Files_sent_out\Data_Sets\OUTCOME.csv" OUT=OUTCOME DBMS=csv REPLACE; GETNAMES=YES; RUN; PROC SORT DATA=DIAGNOS NODUPKEY; BY INC_KEY; RUN; PROC SORT DATA=WT2003; BY INC_KEY; RUN; PROC SORT DATA=DEMO; BY INC_KEY; RUN; PROC SORT DATA=OUTCOME; BY INC_KEY; RUN; **** DATASET READY TO ANALYZE ****; DATA ANALYZE; MERGE WT2003(IN=IN1) DIAGNOS(IN=IN2) DEMO OUTCOME; BY INC_KEY; IF IN1 AND IN2; /* CASES WITH WEIGHTS AND TRAUMA CODE OF INTEREST */; RUN; ***** STATISTICAL ANALYSES *****; PROC SURVEYFREQ DATA=ANALYZE; CLUSTER FAC_KEY; *** FACILITY ID IS THE CLUSTER VARIABLE; STRATA STRATA; *** THE VARIABLE WITH STRATA FOR THE DESIGN; TABLES GENDER RACE DISSTATUS; *** VARIABLES ANALYZED; WEIGHT WEIGHTS; *** WEIGHTS; run; PROC SURVEYMEANS DATA=ANALYZE; WEIGHT WEIGHTS; *** WEIGHTS; CLUSTER FAC_KEY; *** FACILITY ID IS THE CLUSTER VARIABLE; STRATA STRATA; *** THE VARIABLE WITH STRATA FOR THE DESIGN; VAR AGE LOS ICUDAYS; *** VARIABLES ANALYZED; run;