data thcics.question8;
input $ admitting_diag princ_diag_code oth_diag_code1 oth_diag_code2 ;
datalines;
v350 25001 4567
25001 v4001 v4001
v3560 5670 418
2502 v4000
v4000 25032
e560 4352 v3201
518 5670
25029 A1054 6530
;
run;
data thcics.question8;
set thcics.thcicsamp;
ID = _N_;
DIABETES = 0;
CHF = 0;
keep ID DIABETES CHF discharge thcic_id length_of_stay provider_name Admitting_Diag Princ_Diag_Code Oth_Diag_Code2-Oth_Diag_Code10;
array A (*)$5 Admitting_Diag Princ_Diag_Code Oth_Diag_Code2-Oth_Diag_Code10;
do i = 1 to dim(A);
diagnosis = A(i);
IF diagnosis = '39891' OR diagnosis = '40201' OR diagnosis = '40211' OR
diagnosis = '40291' OR diagnosis = '40401' OR diagnosis = '40403' OR
diagnosis = '40411' OR diagnosis = '40413' OR diagnosis = '40491' OR
diagnosis = '40493' OR SUBSTR(diagnosis,1,4)='4251' OR
SUBSTR(diagnosis,1,4)='4254' OR SUBSTR(diagnosis,1,4)='4255' OR
SUBSTR(diagnosis,1,4)='4259' OR SUBSTR(diagnosis,1,4)='4280' OR
SUBSTR(diagnosis,1,4)='4281' OR SUBSTR(diagnosis,1,4)='4289'
then CHF=1;
else CHF = 0;
label chf = 'chf';
IF substr (diagnosis,1,3) IN: ('250') then diabetes = 1;
else diabetes = 0;
label diabetes = 'diabetes';
end;
end;
run;
Hello everyone,
please I have a challenge, I want to code some observations in 10 of my variables ( diagnosis variables containing disease types in codes) to chronic heart failure (chf) and diabetes and then get the number of patients with chf and diabetes. my log shows no error but i oberved that all my chf and diabetes variable was 0 even if the variables had the code for them. my variables from oth_diag_code1-10 was also blank. I will appreciate if you can please help me fish out what is wrong with my syntax. Thanks a lot, as always
ID
THCIC_ID
admitting_diag
princ_diag_code
oth_diag_code_1
oth_diag_code_2
oth_diag_code_3
oth_diag_code_10
diabetes
chf
1
1001
v0291
25010
25021
1
1
2
1001
40291
40291
39891
4255
0
1
3
1002
39891
40493
25053
1
1
4
1003
25001
25002
1
1
... View more