Hello, I am trying to write a code to create a dummy variable for delivery admissions using an array for ICD10 codes and Procedure codes but I run into an error "Array subscript out of range at line 172 column 12. None." data scdny2016dx;
set SCDNY2016;
/* Initialize flags and variables */
scdny2016dx = 0; /* Sickle cell diagnosis flag */
delivery_flag = 0; /* Delivery diagnosis flag */
dxpos = .; /* Diagnosis position */
/* Array for diagnosis codes */
array dx_vars {*} I10_DX1-I10_DX25;
/* Array for procedure codes */
array pr_vars {*} I10_PR1-I10PR10; /* Adjust based on how procedure variables are named */
/* Loop through diagnosis variables to check for sickle cell disease */
do i = 1 to dim(dx_vars);
if dx_vars[i] in ('D5700', 'D5701', 'D5702', 'D57211', 'D57212', 'D57219',
'D57412', 'D57419', 'D57811', 'D57812', 'D57819',
'D571', 'D5720', 'D5740', 'D5780', 'D57411') then do;
scdny2016dx = 1; /* Flag for sickle cell diagnosis */
dxpos = i;
dx = dx_vars[i];
output;
leave;
end;
end;
/* Loop through diagnosis codes to check for delivery diagnoses (ICD-10) */
if dx_vars[i] in ('O60', 'O61', 'O62', 'O63', 'O64', 'O65', 'O66', 'O67',
'O68', 'O69', 'O70', 'O71', 'O72', 'O73', 'O74', 'O75',
'O76', 'O77', 'O78', 'O79', 'O80', 'O81', 'O82', 'Z73',
'Z38') then do;
delivery_flag = 1; /* Flag for delivery diagnosis */
output; /* Output valid record */
end;
/* Loop through procedure codes to check for pregnancy-related deliveries */
do j = 1 to dim(pr_vars);
if pr_vars[j] in ('10D07Z3', '10D07Z4', '10D07Z5', '10D07Z6', '10D07Z7',
'10D07Z8', '10D00Z0', '10D00Z1', '10D00Z2', '10E0XZZ',
'0DQR0ZZ', '0HQ9XZZ', '0KQM0ZZ', '0W8NXZZ') then do;
delivery_flag = 1; /* Flag for delivery procedure code */
output; /* Output valid record */
end;
end;
drop i j; /* Drop the loop index variables */
run;
... View more