-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMMAJOR.sas
48 lines (35 loc) · 2.07 KB
/
MMAJOR.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**************************************************************************************************************************/
/* Macro MMAJOR */
/* Last updated: 10/21/2018; */
/* Last Run: 10/21/2018; */
/* This SAS macro identifies major injury falls among the following two denominator population: */
/* 1) Patients who fell during their NH and went back to same NH */
/* 2) Patients who fell outside of their NH stay */
/**************************************************************************************************************************/
dm 'log;clear;output;clear;';
%MACRO MMAJOR(input,output);
data nhout.&output.;
set nhout.&input.;
array icd{38}
AD_DGNS DGNSCD1-DGNSCD25 DGNSECD1-DGNSECD12;
length dx1-dx38 $25. majorinjury 3.;
array disease{38}
dx1-dx38;
majorinjury=0;
do i=1 to 38;
disease{i}='nonmajor';
if '800' <= substr(ICD{I},1,3) <= '829' then do; disease{i} = 'fracture'; majorinjury=1;end;
else if '830' <= substr(ICD{I},1,3) <= '839' then do; disease{i} = 'dislocation'; majorinjury=1;end;
else if '850'<=substr(ICD{I},1,3)<= '854' or '803'<=substr(ICD{I},1,3)<= '804' and
('2'<=substr(ICD{I},4,1)<='6' or substr(ICD{I},4,2) in ('11' '12')) then do; disease{i} = 'headinjury';majorinjury=1;end;
else if substr(ICD{I},1,4) in('8522' '4321') then do; disease{i} = 'subduralhermatoma';majorinjury=1;end;
end;
run;
proc freq data=nhout.&output.;
tables majorinjury / missing;
run;
%Mend MMAJOR;
/*%MMAJOR(mdspre_samenh_claim_iss,mdspre_samenh_claim_mj)
%MMAJOR(mds_claims_fallout,mds_claims_fallout_mj)
*/
%MMAJOR(mdspre_claim_iss,mdspre_claim_mj)