Hello,
I have a block of code that is quite repetitive, as it processes similar tasks across multiple datasets. To streamline this, I’m trying to create a macro, medpar_analysis, to loop through the dataset medpar for the years 2019 to 2021.
However, when I run the macro, I encounter the following error: ERROR 161-185: No matching DO/SELECT statement.
the error points to a specific line of code within the macro. Interestingly, when I run the same code for an individual dataset (e.g., medpar_2019), it compiles and executes without any issues. This leads me to believe the issue lies in how the macro handles loops or iterates over the datasets.
I’m unsure where the unmatched DO loop or SELECT statement might be causing the error. Could you help identify the problem and suggest a solution?
%macro medpar_analysis;
%do years=2019 %to 2021;
data output.merged_medpar_mbsf_pdpn_&years._1;
set output.merged_medpar_mbsf_pdpn_&years._1;
array DGNS[25] $ DGNS_1_CD -- DGNS_25_CD;
ALZH_MEDPAR = .;
array alzhimers_codes[4] $8 _temporary_ ('G300', 'G301','G308', 'G309');
do i = 1 to dim(DGNS);
if not missing(DGNS[i]) then do;
if strip(DGNS[i]) in alzhimers_codes then ALZH_MEDPAR = 1;
end;
end;
/* Assign 0 to ALZH_MEDPAR for other diagnosis codes */
do i = 1 to dim(DGNS);
if missing(ALZH_MEDPAR) then do;
if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0;
if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0;
end;
end;
/* Assign -9 to ALZH_MEDPAR if all DGNS values are missing */
do i = 1 to dim(DGNS);
if missing(ALZH_MEDPAR) then do;
if missing(DGNS[i]) then ALZH_MEDPAR = -9;
end;
end;
run;
%end;
%mend medpar_analysis;
%medpar_analysis;
Do not double post.
Please show us the part of the log that has the error. Let's see for example 100 lines before the error and of course the error itself.
Now this is extremely important, do not skip this step. Copy the log as text and then paste it into the window that appears when you click on the </> icon.
here is the error with the relevant lines of code
do i = 1 to dim(DGNS);
44138 if not missing(DGNS[i]) then do;
44139 if strip(DGNS[i]) in alzhimers_codes then ALZH_MEDPAR = 1;
44140 end;
44141 end;
44142
44143 /* Assign 0 to ALZH_MEDPAR for other diagnosis codes */
44144 do i = 1 to dim(DGNS);
44145 if missing(ALZH_MEDPAR) then do;
44146 if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0;
44147 if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0;
44148 if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0;
44149 if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0;
44150 if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0;
44151 if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0;
44152 if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0;
44153 if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0;
44154 if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0;
44155 if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0;
44156 if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0;
44157 if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0;
44158 if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0;
44159 end;
44160 end;
44161
44162 /* Assign -9 to ALZH_MEDPAR if all DGNS values are missing */
44163 do i = 1 to dim(DGNS);
44164 if missing(ALZH_MEDPAR) then do;
44165 if missing(DGNS[i]) then ALZH_MEDPAR = -9;
44166 end;
44167 end;
44168
44169
44231 %end;
44232 %mend medpar_analysis;
44233 %medpar_analysis;
NOTE: Line generated by the invoked macro "MEDPAR_ANALYSIS".
127 then ALZH_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0;
127 ! if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; end; end; do i = 1 to dim(DGNS)
---
161
127 ! ; if missing(ALZH_MEDPAR) then do; if missing(DGNS[i])
ERROR 161-185: No matching DO/SELECT statement.
Since the macro is essentially just running a series of data steps (the only part that is changing is the name of the datasets read and written) you can debug the logic without the complications of wrapping it in a macro. Once you have the logic working you can put the fixed data step into the macro again.
when I used the code I wrote in the medpar_2019 dataset the datastep compiled, but the issue was when I tried using the macro as defined below the loop broke, not sure what is going on
%macro medpar_analysis;
%do years=2019 %to 2021;
I asked to see 100 lines in the LOG before the error, you didn't show that. You showed the code.
I said: "Now this is extremely important, do not skip this step. Copy the log as text and then paste it into the window that appears when you click on the </> icon. "
and you didn't perform this step.
44132 /* Alzhimers diagnosis*/ 44133 44134 /*Assign 1 to ALZH_MEDPAR for matches in alzhimers_codes; 44135 44136 44137 do i = 1 to dim(DGNS); 44138 if not missing(DGNS[i]) then do; 44139 if strip(DGNS[i]) in alzhimers_codes then ALZH_MEDPAR = 1; 44140 end; 44141 end; 44142 44143 /* Assign 0 to ALZH_MEDPAR for other diagnosis codes */ 44144 do i = 1 to dim(DGNS); 44145 if missing(ALZH_MEDPAR) then do; 44146 if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0; 44147 if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0; 44148 if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0; 44149 if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0; 44150 if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0; 44151 if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0; 44152 if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0; 44153 if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0; 44154 if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0; 44155 if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0; 44156 if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0; 44157 if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 44158 if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; 44159 end; 44160 end; 44161 44162 /* Assign -9 to ALZH_MEDPAR if all DGNS values are missing */ 44163 do i = 1 to dim(DGNS); 44164 if missing(ALZH_MEDPAR) then do; 44165 if missing(DGNS[i]) then ALZH_MEDPAR = -9; 44166 end; 44167 end; 44168 44169 44170 44171 /* verifying*/ 44172 /* Initialize alzheimer indicators to 0 */ 44173 alzh_indicator_1 = 0; 44174 alzh_indicator_2 = 0; 44175 alzh_indicator_3 = 0; 44176 alzh_indicator_4 = 0; 44177 alzh_indicator_5 = 0; 44178 alzh_indicator_6 = 0; 44179 alzh_indicator_7 = 0; 44180 alzh_indicator_8 = 0; 44181 alzh_indicator_9 = 0; 44182 alzh_indicator_10 = 0; 44183 alzh_indicator_11 = 0; 44184 alzh_indicator_12 = 0; 44185 alzh_indicator_13 = 0; 44186 alzh_indicator_14 = 0; 44187 alzh_indicator_15 = 0; 44188 alzh_indicator_16 = 0; 44189 alzh_indicator_17 = 0; 44190 alzh_indicator_18 = 0; 44191 alzh_indicator_19 = 0; 44192 alzh_indicator_20 = 0; 44193 alzh_indicator_21 = 0; 44194 alzh_indicator_22 = 0; 44195 alzh_indicator_23 = 0; 44196 alzh_indicator_24 = 0; 44197 alzh_indicator_25 = 0; 44198 alzh_indicator_all = 0; 44199 44200 /* Check DGNS_X_CD variables against alzhimers_codes */ 44201 if strip(DGNS_1_CD) in alzhimers_codes then alzh_indicator_1 = 1; 44202 if strip(DGNS_2_CD) in alzhimers_codes then alzh_indicator_2 = 1; 44203 if strip(DGNS_3_CD) in alzhimers_codes then alzh_indicator_3 = 1; 44204 if strip(DGNS_4_CD) in alzhimers_codes then alzh_indicator_4 = 1; 44205 if strip(DGNS_5_CD) in alzhimers_codes then alzh_indicator_5 = 1; 44206 if strip(DGNS_6_CD) in alzhimers_codes then alzh_indicator_6 = 1; 44207 if strip(DGNS_7_CD) in alzhimers_codes then alzh_indicator_7 = 1; 44208 if strip(DGNS_8_CD) in alzhimers_codes then alzh_indicator_8 = 1; 44209 if strip(DGNS_9_CD) in alzhimers_codes then alzh_indicator_9 = 1; 44210 if strip(DGNS_10_CD) in alzhimers_codes then alzh_indicator_10 = 1; 44211 if strip(DGNS_11_CD) in alzhimers_codes then alzh_indicator_11 = 1; 44212 if strip(DGNS_12_CD) in alzhimers_codes then alzh_indicator_12 = 1; 44213 if strip(DGNS_13_CD) in alzhimers_codes then alzh_indicator_13 = 1; 44214 if strip(DGNS_14_CD) in alzhimers_codes then alzh_indicator_14 = 1; 44215 if strip(DGNS_15_CD) in alzhimers_codes then alzh_indicator_15 = 1; 44216 if strip(DGNS_16_CD) in alzhimers_codes then alzh_indicator_16 = 1; 44217 if strip(DGNS_17_CD) in alzhimers_codes then alzh_indicator_17 = 1; 44218 if strip(DGNS_18_CD) in alzhimers_codes then alzh_indicator_18 = 1; 44219 if strip(DGNS_19_CD) in alzhimers_codes then alzh_indicator_19 = 1; 44220 if strip(DGNS_20_CD) in alzhimers_codes then alzh_indicator_20 = 1; 44221 if strip(DGNS_21_CD) in alzhimers_codes then alzh_indicator_21 = 1; 44222 if strip(DGNS_22_CD) in alzhimers_codes then alzh_indicator_22 = 1; 44223 if strip(DGNS_23_CD) in alzhimers_codes then alzh_indicator_23 = 1; 44224 if strip(DGNS_24_CD) in alzhimers_codes then alzh_indicator_24 = 1; 44225 if strip(DGNS_25_CD) in alzhimers_codes then alzh_indicator_25 = 1; 44226 44227 /* Sum the indicators and check for at least one match */ 44228 alzh_indicator_count = sum(of alzh_indicator_1-alzh_indicator_25); 44229 if alzh_indicator_count > 0 then alzh_indicator_all = 1; 44230 44231 %end; 44232 %mend medpar_analysis; 44233 %medpar_analysis; NOTE: There were 600538 observations read from the data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2021_1. NOTE: The data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2021_1 has 600538 observations and 763 variables. NOTE: DATA statement used (Total process time): real time 2:52.64 cpu time 31.73 seconds NOTE: Line generated by the invoked macro "MEDPAR_ANALYSIS". 127 then ALZH_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 127 ! if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; end; end; do i = 1 to dim(DGNS) --- 161 127 ! ; if missing(ALZH_MEDPAR) then do; if missing(DGNS[i]) ERROR 161-185: No matching DO/SELECT statement. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2019_1 may be incomplete. When this step was stopped there were 0 observations and 817 variables. WARNING: Data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2019_1 was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.04 seconds cpu time 0.01 seconds NOTE: Line generated by the invoked macro "MEDPAR_ANALYSIS". 269 then ALZH_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 269 ! if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; end; end; do i = 1 to dim(DGNS) --- 161 269 ! ; if missing(ALZH_MEDPAR) then do; if missing(DGNS[i]) ERROR 161-185: No matching DO/SELECT statement. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2020_1 may be incomplete. When this step was stopped there were 0 observations and 763 variables. WARNING: Data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2020_1 was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.04 seconds cpu time 0.01 seconds NOTE: Line generated by the invoked macro "MEDPAR_ANALYSIS". 411 then ALZH_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 411 ! if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; end; end; do i = 1 to dim(DGNS) --- 161 411 ! ; if missing(ALZH_MEDPAR) then do; if missing(DGNS[i]) ERROR 161-185: No matching DO/SELECT statement.
Turn on the macro debugging tools by running this command.
options mprint;
Then run your code again.
Show us the log all the way down to the ERROR (all of it down to the error), pasted into the </> window.
44234 options mprint; 44235 %macro medpar_analysis; 44236 %do years=2019 %to 2021; 44237 44238 data output.merged_medpar_mbsf_pdpn_&years._1; 44239 set output.merged_medpar_mbsf_pdpn_&years._1; 44240 array DGNS[25] $ DGNS_1_CD -- DGNS_25_CD; 44241 DEPRESSION_MEDPAR = .; 44242 NONALZH_DEMEN_MEDPAR = .; 44243 ALZH_MEDPAR = .; 44244 PNEUMO_MEDPAR = .; 44245 hf_medpar =.; 44246 PRKNSN_MEDPAR = .; 44247 STROKE_TIA_MEDPAR = .; 44248 ANXI_MEDICARE_MEDPAR =.; 44249 BIPOLAR_MEDPAR = .; 44250 TBI_MEDPAR = .; 44251 DRUGS_MEDPAR = .; 44252 SCHIOT_MEDPAR = .; 44253 OUD_ANY_MEDPAR = .; 44254 44255 array depression_codes[50] $8 _temporary_ ('F0631', 'F0632', 'F310', 'F3110', 'F3111', 'F3112', 44255! 'F3113', 44256 'F312', 'F3130', 'F3131', 'F3132', 'F314', 44256! 'F315', 'F3160', 44257 'F3161', 'F3162', 'F3163', 'F3164', 'F3171', 44257! 'F3173', 'F3175', 44258 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 44258! 'F319', 'F320', 44259 'F321', 'F322', 'F323', 'F324', 'F325', 'F328', 44259! 'F3289', 44260 'F329', 'F32A', 'F330', 'F331', 'F332', 'F333', 44260! 'F3340', 44261 'F3341', 'F3342', 'F338', 'F339', 'F340', 44261! 'F341', 'F4321', 'F4323'); 44262 44263 array nonalzhimers_codes[84] $8 _temporary_ ('F0150', 'F0151', 'F01511', 'F01518', 'F0152', 44263! 'F0153', 'F0154', 44264 'F01A0', 'F01A11', 'F01A18', 'F01A2', 'F01A3', 44264! 'F01A4', 'F01B0', 44265 'F01B11', 'F01B18', 'F01B2', 'F01B3', 'F01B4', 44265! 'F01C0', 'F01C11', 44266 'F01C18', 'F01C2', 'F01C3', 'F01C4', 'F0280', 44266! 'F0281', 'F02811', 44267 'F02818', 'F0282', 'F0283', 'F0284', 'F02A0', 44267! 'F02A11', 'F02A18', 44268 'F02A2', 'F02A3', 'F02A4', 'F02B0', 'F02B11', 44268! 'F02B18', 'F02B2', 44269 'F02B3', 'F02B4', 'F02C0', 'F02C11', 'F02C18', 44269! 'F02C2', 'F02C3', 44270 'F02C4', 'F0390', 'F0391', 'F03911', 'F03918', 44270! 'F0392', 'F0393', 44271 'F0394', 'F03A0', 'F03A11', 'F03A18', 'F03A2', 44271! 'F03A3', 'F03A4', 44272 'F03B0', 'F03B11', 'F03B18', 'F03B2', 'F03B3', 44272! 'F03B4', 'F03C0', 44273 'F03C11', 'F03C18', 'F03C2', 'F03C3', 'F03C4', 44273! 'F05', 'G138', 44274 'G3101', 'G3109', 'G311', 'G312', 'G3183', 'G94', 44274! 'R4181'); 44275 44276 array alzhimers_codes[4] $8 _temporary_ ('G300', 'G301','G308', 'G309'); 44277 44278 array pneumonia_codes[93] $8 _temporary_( 44279 'A0103', 'A0222', 'A065', 'A202', 'A212', 'A221', 'A310', 'A3701', 'A3711', 'A3781', 44279! 'A3791', 44280 'A403', 'A420', 'A430', 'A481', 'A5004', 'A5484', 'B012', 'B052', 'B0681', 'B371', 'B380', 44281 'B382', 'B390', 'B392', 'B400', 'B402', 'B410', 'B583', 'B59', 'B664', 'B671', 'B7781', 44281! 'B953', 44282 'B960', 'B961', 'J09X1', 'J1000', 'J1001', 'J1008', 'J1100', 'J1108', 'J120', 'J121', 44282! 'J122', 44283 'J123', 'J1281', 'J1282', 'J1289', 'J129', 'J13', 'J14', 'J150', 'J151', 'J1520', 'J15211', 44284 'J15212', 'J1529', 'J153', 'J154', 'J155', 'J156', 'J1561', 'J1569', 'J157', 'J158', 44284! 'J159', 44285 'J160', 'J168', 'J17', 'J180', 'J181', 'J182', 'J188', 'J189', 'J200', 'J84111', 'J84116', 44286 'J84117', 'J84178', 'J842', 'J851', 'J95851', 'P230', 'P231', 'P232', 'P233', 'P234', 44286! 'P235', 44287 'P236', 'P238', 'P239', 'Z8701'); 44288 44289 array hf_codes[34] $8 _temporary_ ( 44290 'I0981', 'I110', 'I130', 'I132', 'I420', 'I425', 'I426', 'I427', 'I428', 'I43', 'I501', 44290! 'I5020', 44291 'I5021', 'I5022', 'I5023', 'I5030', 'I5031', 'I5032', 'I5033', 'I5040', 'I5041', 'I5042', 44291! 'I5043', 44292 'I50810', 'I50811', 'I50812', 'I50813', 'I50814', 'I5082', 'I5083', 'I5084', 'I5089', 44292! 'I509', 'P290'); 44293 44294 array prknsn_codes[13] $8 _temporary_ ( 44295 'G20', 'G20A1', 'G20A2', 'G20B1', 'G20B2', 'G20C', 'G2111', 'G2119', 'G213', 'G214', 44295! 'G218', 'G219', 'G3183'); 44296 44297 array stroke_codes[150] $8 _temporary_ ( 44298 'G450', 'G451', 'G452', 'G453', 'G458', 'G459', 'G460', 'G461', 'G462', 'G463', 'G464', 44298! 'G465', 44299 'G466', 'G467', 'G468', 'G9731', 'G9732', 'I6000', 'I6001', 'I6002', 'I6010', 'I6011', 44299! 'I6012', 44300 'I602', 'I6020', 'I6021', 'I6022', 'I6030', 'I6031', 'I6032', 'I604', 'I6050', 'I6051', 44300! 'I6052', 44301 'I606', 'I607', 'I608', 'I609', 'I610', 'I611', 'I612', 'I613', 'I614', 'I615', 'I616', 44301! 'I618', 44302 'I619', 'I6200', 'I6201', 'I6202', 'I629', 'I6300', 'I63011', 'I63012', 'I63013', 'I63019', 44303 'I6302', 'I63031', 'I63032', 'I63033', 'I63039', 'I6309', 'I6310', 'I63111', 'I63112', 44303! 'I63113', 44304 'I63119', 'I6312', 'I63131', 'I63132', 'I63133', 'I63139', 'I6319', 'I6320', 'I63211', 44304! 'I63212', 44305 'I63213', 'I63219', 'I6322', 'I63231', 'I63232', 'I63233', 'I63239', 'I6329', 'I6330', 44305! 'I63311', 44306 'I63312', 'I63313', 'I63319', 'I63321', 'I63322', 'I63323', 'I63329', 'I63331', 'I63332', 44306! 'I63333', 44307 'I63339', 'I63341', 'I63342', 'I63343', 'I63349', 'I6339', 'I6340', 'I63411', 'I63412', 44307! 'I63413', 44308 'I63419', 'I63421', 'I63422', 'I63423', 'I63429', 'I63431', 'I63432', 'I63433', 'I63439', 44308! 'I63441', 44309 'I63442', 'I63443', 'I63449', 'I6349', 'I6350', 'I63511', 'I63512', 'I63513', 'I63519', 44309! 'I63521', 44310 'I63522', 'I63523', 'I63529', 'I63531', 'I63532', 'I63533', 'I63539', 'I63541', 'I63542', 44310! 'I63543', 44311 'I63549', 'I6359', 'I636', 'I638', 'I6381', 'I6389', 'I639', 'I67841', 'I67848', 'I6789', 44311! 'I97810', 44312 'I97811', 'I97820', 'I97821'); 44313 44314 array stroke_exclusion_codes[119] $8 _temporary_ ( 44315 'S06340A', 'S06341A', 'S06342A', 'S06343A', 'S06344A', 'S06345A', 'S06346A', 'S06347A', 44315! 'S06348A', 44316 'S0634AA', 'S06349A', 'S06350A', 'S06351A', 'S06352A', 'S06353A', 'S06354A', 'S06355A', 44316! 'S06356A', 44317 'S06357A', 'S06358A', 'S0635AA', 'S06359A', 'S06360A', 'S06361A', 'S06362A', 'S06363A', 44317! 'S06364A', 44318 'S06365A', 'S06366A', 'S06367A', 'S06368A', 'S0636AA', 'S06369A', 'S06370A', 'S06371A', 44318! 'S06372A', 44319 'S06373A', 'S06374A', 'S06375A', 'S06376A', 'S06377A', 'S06378A', 'S0637AA', 'S06379A', 44319! 'S06380A', 44320 'S06381A', 'S06382A', 'S06383A', 'S06384A', 'S06385A', 'S06386A', 'S06387A', 'S06388A', 44320! 'S0638AA', 44321 'S06389A', 'S065X0A', 'S065X1A', 'S065X2A', 'S065X3A', 'S065X4A', 'S065X5A', 'S065X6A', 44321! 'S065X7A', 44322 'S065X8A', 'S065XAA', 'S065X9A', 'S066X0A', 'S066X1A', 'S066X2A', 'S066X3A', 'S066X4A', 44322! 'S066X5A', 44323 'S066X6A', 'S066X7A', 'S066X8A', 'S066XAA', 'S066X9A', 'S06810A', 'S06811A', 'S06812A', 44323! 'S06813A', 44324 'S06814A', 'S06815A', 'S06816A', 'S06817A', 'S06818A', 'S0681AA', 'S06819A', 'S06820A', 44324! 'S06821A', 44325 'S06822A', 'S06823A', 'S06824A', 'S06825A', 'S06826A', 'S06827A', 'S06828A', 'S0682AA', 44325! 'S06829A', 44326 'S06890A', 'S06891A', 'S06892A', 'S06893A', 'S06894A', 'S06895A', 'S06896A', 'S06897A', 44326! 'S06898A', 44327 'S0689AA', 'S06899A', 'S069X0A', 'S069X1A', 'S069X2A', 'S069X3A', 'S069X4A', 'S069X5A', 44327! 'S069X6A', 44328 'S069X7A', 'S069X8A'); 44329 44330 44331 array anxiety_codes[49] $8 _temporary_ ( 44332 'F064', 'F4000', 'F4001', 'F4002', 'F4010', 'F4011', 'F40210', 'F40218', 'F40220', 44332! 'F40228', 44333 'F40230', 'F40231', 'F40232', 'F40233', 'F40240', 'F40241', 'F40242', 'F40243', 'F40248', 44333! 'F40290', 44334 'F40291', 'F40298', 'F408', 'F409', 'F410', 'F411', 'F413', 'F418', 'F419', 'F42', 'F422', 44335 'F423', 'F424', 'F428', 'F429', 'F430', 'F4310', 'F4311', 'F4312', 'F449', 'F458', 'F488', 44336 'F489', 'F938', 'F99', 'R452', 'R455', 'R456', 'R457'); 44337 44338 44339 array bipolar_codes[42] $8 _temporary_ ( 44340 'F3010', 'F3011', 'F3012', 'F3013', 'F302', 'F303', 'F304', 'F308', 'F309', 'F310', 44340! 'F3110', 44341 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 44341! 'F3161', 44342 'F3162', 'F3163', 'F3164', 'F3170', 'F3171', 'F3172', 'F3173', 'F3174', 'F3175', 'F3176', 44342! 'F3177', 44343 'F3178', 'F3181', 'F3189', 'F319', 'F338', 'F3481', 'F3489', 'F349', 'F39'); 44344 44345 44346 44347 array TBI_codes [262] $8 _temporary_( 44348 'F070', 'F0781', 'F0789', 'F482', 'S04011S', 'S04012S', 'S04019S', 'S0402XS', 'S04031S', 44348! 'S04032S', 44349 'S04039S', 'S04041S', 'S04042S', 'S04049S', 'S0410XS', 'S0411XS', 'S0412XS', 'S0420XS', 44349! 'S0421XS', 44350 'S0422XS', 'S0430XS', 'S0431XS', 'S0432XS', 'S0440XS', 'S0441XS', 'S0442XS', 'S0450XS', 44350! 'S0451XS', 44351 'S0452XS', 'S0460XS', 'S0461XS', 'S0462XS', 'S0470XS', 'S0471XS', 'S0472XS', 'S04811S', 44351! 'S04812S', 44352 'S04819S', 'S04891S', 'S04892S', 'S04899S', 'S049XXS', 'S060X0S', 'S060X1S', 'S060X2S', 44352! 'S060X3S', 44353 'S060X4S', 'S060X5S', 'S060X6S', 'S060X7S', 'S060X8S', 'S060XAS', 'S060X9S', 'S061X0S', 44353! 'S061X1S', 44354 'S061X2S', 'S061X3S', 'S061X4S', 'S061X5S', 'S061X6S', 'S061X7S', 'S061X8S', 'S061XAS', 44354! 'S061X9S', 44355 'S062X0S', 'S062X1S', 'S062X2S', 'S062X3S', 'S062X4S', 'S062X5S', 'S062X6S', 'S062X7S', 44355! 'S062X8S', 44356 'S062XAS', 'S062X9S', 'S06300S', 'S06301S', 'S06302S', 'S06303S', 'S06304S', 'S06305S', 44356! 'S06306S', 44357 'S06307S', 'S06308S', 'S0630AS', 'S06309S', 'S06310S', 'S06311S', 'S06312S', 'S06313S', 44357! 'S06314S', 44358 'S06315S', 'S06316S', 'S06317S', 'S06318S', 'S0631AS', 'S06319S', 'S06320S', 'S06321S', 44358! 'S06322S', 44359 'S06323S', 'S06324S', 'S06325S', 'S06326S', 'S06327S', 'S06328S', 'S0632AS', 'S06329S', 44359! 'S06330S', 44360 'S06331S', 'S06332S', 'S06333S', 'S06334S', 'S06335S', 'S06336S', 'S06337S', 'S06338S', 44360! 'S0633AS', 44361 'S06339S', 'S06340S', 'S06341S', 'S06342S', 'S06343S', 'S06344S', 'S06345S', 'S06346S', 44361! 'S06347S', 44362 'S06348S', 'S0634AS', 'S06349S', 'S06350S', 'S06351S', 'S06352S', 'S06353S', 'S06354S', 44362! 'S06355S', 44363 'S06356S', 'S06357S', 'S06358S', 'S0635AS', 'S06359S', 'S06360S', 'S06361S', 'S06362S', 44363! 'S06363S', 44364 'S06364S', 'S06365S', 'S06366S', 'S06367S', 'S06368S', 'S0636AS', 'S06369S', 'S06370S', 44364! 'S06371S', 44365 'S06372S', 'S06373S', 'S06374S', 'S06375S', 'S06376S', 'S06377S', 'S06378S', 'S0637AS', 44365! 'S06379S', 44366 'S06380S', 'S06381S', 'S06382S', 'S06383S', 'S06384S', 'S06385S', 'S06386S', 'S06387S', 44366! 'S06388S', 44367 'S0638AS', 'S06389S', 'S064X0S', 'S064X1S', 'S064X2S', 'S064X3S', 'S064X4S', 'S064X5S', 44367! 'S064X6S', 44368 'S064X7S', 'S064X8S', 'S064XAS', 'S064X9S', 'S065X0S', 'S065X1S', 'S065X2S', 'S065X3S', 44368! 'S065X4S', 44369 'S065X5S', 'S065X6S', 'S065X7S', 'S065X8S', 'S065XAS', 'S065X9S', 'S066X0S', 'S066X1S', 44369! 'S066X2S', 44370 'S066X3S', 'S066X4S', 'S066X5S', 'S066X6S', 'S066X7S', 'S066X8S', 'S066XAS', 'S066X9S', 44370! 'S06810S', 44371 'S06811S', 'S06812S', 'S06813S', 'S06814S', 'S06815S', 'S06816S', 'S06817S', 'S06818S', 44371! 'S0681AS', 44372 'S06819S', 'S06820S', 'S06821S', 'S06822S', 'S06823S', 'S06824S', 'S06825S', 'S06826S', 44372! 'S06827S', 44373 'S06828S', 'S0682AS', 'S06829S', 'S068A0S', 'S068A1S', 'S068A2S', 'S068A3S', 'S068A4S', 44373! 'S068A5S', 44374 'S068A6S', 'S068AAS', 'S068A9S', 'S06890S', 'S06891S', 'S06892S', 'S06893S', 'S06894S', 44374! 'S06895S', 44375 'S06896S', 'S06897S', 'S06898S', 'S0689AS', 'S06899S', 'S069X0S', 'S069X1S', 'S069X2S', 44375! 'S069X3S', 44376 'S069X4S', 'S069X5S', 'S069X6S', 'S069X7S', 'S069X8S', 'S069XAS', 'S069X9S', 'S06A0XS', 44376! 'S06A1XS'); 44377 44378 44379 array DRUG_USE_CODES[133] $8 _temporary_ ('HZ2ZZZZ', 'HZ30ZZZ', 'HZ31ZZZ', 'HZ32ZZZ', 44380 'HZ33ZZZ', 'HZ34ZZZ', 'HZ35ZZZ', 'HZ36ZZZ', 44381 'HZ37ZZZ', 'HZ38ZZZ', 'HZ39ZZZ', 'HZ3BZZZ', 44382 'HZ40ZZZ', 'HZ93ZZZ', 'HZ96ZZZ' 44383 'F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 44383! 'F11159', 44384 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 44384! 'F1123', 44385 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 44385! 'F11920', 44386 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 44386! 'F11982', 44387 'F11988', 'F1199', 'F1210', 'F12120', 'F12121', 'F12122', 'F12129', 'F1213', 'F12150', 44387! 'F12151', 44388 'F12159', 'F12180', 'F12188', 'F1219', 'F1220', 'F12220', 'F12221', 'F12222', 'F12229', 44388! 'F12250', 44389 'F1629', 'F1690', 'F16920', 'F16921', 'F16929', 'F1694', 'F16950', 'F16951', 'F16959', 44389! 'F16980', 44390 'F16983', 'F16988', 'F1699', 'F17203', 'F17208', 'F17209', 'F17213', 'F17218', 'F17219', 44390! 'F17223', 44391 'F17228', 'F17229', 'F17293', 'F17298', 'F17299', 'F1810', 'F18120', 'F18121', 'F18129', 44391! 'F1814', 44392 'F18150', 'F18151', 'F18159', 'F1817', 'F18180', 'F18188', 'F1819', 'F1820', 'F18220', 44392! 'F18221', 44393 'F18229', 'F1824', 'F18250', 'F18251', 'F18259', 'F1827', 'F18280', 'F18288', 'F1829', 44393! 'F1890', 44394 'F18920', 'F18921', 'F18929', 'F1894', 'F18950', 'F18951', 'F18959', 'F1897'); 44395 44396 array PSYCH_CODES[12] $8 _temporary_ ('F200', 'F201', 'F202', 'F203', 'F205', 'F2081', 44397 'F2089', 'F209', 'F250', 'F251', 'F258', 'F259'); 44398 44399 44400 array OUD_codes[197] $8 _temporary_ ('F1110', 'F11120', 'F11121', 'F11122', 'F11129', 44400! 'F1113', 'F1114', 'F11150', 'F11151', 44401 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 44401! 'F11229', 'F1123', 44402 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 44402! 'F11920', 44403 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 44403! 'F11982', 44404 'F11988', 'F1199', 'HZ81ZZZ', 'HZ84ZZZ', 'HZ85ZZZ', 'HZ86ZZZ', 'HZ91ZZZ', 'HZ94ZZZ', 44404! 'HZ95ZZZ', 44405 'HZ96ZZZ', 'T400X1A', 'T400X1D', 'T400X1S', 'T400X2A', 'T400X2D', 'T400X2S', 'T400X3A', 44405! 'T400X3D', 44406 'T400X3S', 'T400X4A', 'T400X4D', 'T400X4S', 'T400X5A', 'T400X5D', 'T400X5S', 'T401X1A', 44406! 'T401X1D', 44407 'T401X1S', 'T401X2A', 'T401X2D', 'T401X2S', 'T401X3A', 'T401X3D', 'T401X3S', 'T401X4A', 44407! 'T401X4D', 44408 'T401X4S', 'T402X1A', 'T402X1D', 'T402X1S', 'T402X2A', 'T402X2D', 'T402X2S', 'T402X3A', 44408! 'T402X3D', 44409 'T402X3S', 'T402X4A', 'T402X4D', 'T402X4S', 'T402X5A', 'T402X5D', 'T402X5S', 'T403X1A', 44409! 'T403X1D', 44410 'T403X1S', 'T403X2A', 'T403X2D', 'T403X2S', 'T403X3A', 'T403X3D', 'T403X3S', 'T403X4A', 44410! 'T403X4D', 44411 'T403X4S', 'T403X5A', 'T403X5D', 'T403X5S', 'T40411A', 'T40411D', 'T40411S', 'T40412A', 44411! 'T40412D', 44412 'T40412S', 'T40413A', 'T40413D', 'T40413S', 'T40414A', 'T40414D', 'T40414S', 'T40415A', 44412! 'T40415D', 44413 'T40415S', 'T40421A', 'T40421D', 'T40421S', 'T40422A', 'T40422D', 'T40422S', 'T40423A', 44413! 'T40423D', 44414 'T40423S', 'T40424A', 'T40424D', 'T40424S', 'T40425A', 'T40425D', 'T40425S', 'T40491A', 44414! 'T40491D', 44415 'T40491S', 'T40492A', 'T40492D', 'T40492S', 'T40493A', 'T40493D', 'T40493S', 'T40494A', 44415! 'T40494D', 44416 'T40494S', 'T40495A', 'T40495D', 'T40495S', 'T404X1A', 'T404X1D', 'T404X1S', 'T404X2A', 44416! 'T404X2D', 44417 'T404X2S', 'T404X3A', 'T404X3D', 'T404X3S', 'T404X4A', 'T404X4D', 'T404X4S', 'T404X5A', 44417! 'T404X5D', 44418 'T404X5S', 'T40601A', 'T40601D', 'T40601S', 'T40602A', 'T40602D', 'T40602S', 'T40603A', 44418! 'T40603D', 44419 'T40603S', 'T40604A', 'T40604D', 'T40604S', 'T40605A', 'T40605D', 'T40605S', 'T40691A', 44419! 'T40691D', 44420 'T40691S', 'T40692A', 'T40692D', 'T40692S', 'T40693A', 'T40693D', 'T40693S', 'T40694A', 44420! 'T40694D', 44421 'T40694S', 'T40695A', 'T40695D', 'T40695S'); 44422 44423 /* 44424 if strip(DGNS[i]) in nonalzhimers_codes then medical_indicator = -1; 44425 if strip(DGNS[i]) in alzhimers_codes then medical_indicator = -2; 44426 if strip(DGNS[i]) in pneumonia_codes then medical_indicator = -3; 44427 if strip(DGNS[i]) in hf_codes then medical_indicator = -4; 44428 if strip(DGNS[i]) in prknsn_codes then medical_indicator = -5; 44429 if strip(DGNS[i]) in stroke_codes then medical_indicator = -6; 44430 if strip(DGNS[i]) in stroke_exclusion_codes then medical_indicator = -7; 44431 if strip(DGNS[i]) in anxiety_codes then medical_indicator = -8; 44432 if strip(DGNS[i]) in bipolar_codes then medical_indicator = -9; 44433 if strip(DGNS[i]) in TBI_codes then medical_indicator = 10; 44434 if strip(DGNS[i]) in DRUG_USE_CODES then medical_indicator = -11; 44435 if strip(DGNS[i]) in PSYCH_CODES then medical_indicator = -12; 44436 if strip(DGNS[i]) in OUD_CODES then medical_indicator = -13; 44437 44438 */ 44439 44440 /* DEPRESSION_MEDPAR*/ 44441 /*this part of the code will assign a 1 to any depression codes*/ 44442 do i = 1 to dim(DGNS); 44443 if not missing(DGNS[i])then do; 44444 if strip(DGNS[i]) in depression_codes then DEPRESSION_MEDPAR=1; 44445 end; 44446 end; 44447 44448 44449 /* this part of the code will an a 0 to the depression indicator if there are any diagnosis 44449! codes*/ 44450 44451 do i = 1 to dim(DGNS); 44452 if missing(DEPRESSION_MEDPAR) then do; 44453 if strip(DGNS[i]) in nonalzhimers_codes then DEPRESSION_MEDPAR =0; 44454 if strip(DGNS[i]) in alzhimers_codes then DEPRESSION_MEDPAR = 0; 44455 if strip(DGNS[i]) in pneumonia_codes then DEPRESSION_MEDPAR= 0; 44456 if strip(DGNS[i]) in hf_codes then DEPRESSION_MEDPAR = 0; 44457 if strip(DGNS[i]) in prknsn_codes then DEPRESSION_MEDPAR = 0; 44458 if strip(DGNS[i]) in stroke_codes then DEPRESSION_MEDPAR = 0; 44459 if strip(DGNS[i]) in stroke_exclusion_codes then DEPRESSION_MEDPAR = 0; 44460 if strip(DGNS[i]) in anxiety_codes then DEPRESSION_MEDPAR = 0; 44461 if strip(DGNS[i]) in bipolar_codes then DEPRESSION_MEDPAR = 0; 44462 if strip(DGNS[i]) in TBI_codes then DEPRESSION_MEDPAR = 0; 44463 if strip(DGNS[i]) in DRUG_USE_CODES then DEPRESSION_MEDPAR = 0; 44464 if strip(DGNS[i]) in PSYCH_CODES then DEPRESSION_MEDPAR = 0; 44465 if strip(DGNS[i]) in OUD_CODES then DEPRESSION_MEDPAR = 0; 44466 end; 44467 end; 44468 44469 44470 44471 44472 *assigning -9 to missing DGNS values; 44473 44474 do i = 1 to dim(DGNS); 44475 if missing(DEPRESSION_MEDPAR) then do; 44476 if missing(DGNS[i]) then DEPRESSION_MEDPAR =-9; 44477 44478 end; 44479 end; 44480 44481 44482 44483 44484 * 44485 end; 44486 44487 /* verifying*/ 44488 44489 indicator1 = 0; 44490 indicator2 = 0; 44491 indicator3 = 0; 44492 indicator4 = 0; 44493 indicator5 = 0; 44494 indicator6 = 0; 44495 indicator7 = 0; 44496 indicator8 = 0; 44497 indicator9 = 0; 44498 indicator10 = 0; 44499 indicator11 = 0; 44500 indicator12 = 0; 44501 indicator13 = 0; 44502 indicator14 = 0; 44503 indicator15 = 0; 44504 indicator16 = 0; 44505 indicator17 = 0; 44506 indicator18 = 0; 44507 indicator19 = 0; 44508 indicator20 = 0; 44509 indicator21 = 0; 44510 indicator22 = 0; 44511 indicator23 = 0; 44512 indicator24 = 0; 44513 indicator25 = 0; 44514 indicator_all = 0; 44515 44516 44517 if strip(DGNS_1_CD) in depression_codes then indicator1 = 1; 44518 if strip(DGNS_2_CD) in depression_codes then indicator2 = 1; 44519 if strip(DGNS_3_CD) in depression_codes then indicator3 = 1; 44520 if strip(DGNS_4_CD) in depression_codes then indicator4 = 1; 44521 if strip(DGNS_5_CD) in depression_codes then indicator5 = 1; 44522 if strip(DGNS_6_CD) in depression_codes then indicator6 = 1; 44523 if strip(DGNS_7_CD) in depression_codes then indicator7 = 1; 44524 if strip(DGNS_8_CD) in depression_codes then indicator8 = 1; 44525 if strip(DGNS_9_CD) in depression_codes then indicator9 = 1; 44526 if strip(DGNS_10_CD) in depression_codes then indicator10 = 1; 44527 if strip(DGNS_11_CD) in depression_codes then indicator11 = 1; 44528 if strip(DGNS_12_CD) in depression_codes then indicator12 = 1; 44529 if strip(DGNS_13_CD) in depression_codes then indicator13 = 1; 44530 if strip(DGNS_14_CD) in depression_codes then indicator14 = 1; 44531 if strip(DGNS_15_CD) in depression_codes then indicator15 = 1; 44532 if strip(DGNS_16_CD) in depression_codes then indicator16 = 1; 44533 if strip(DGNS_17_CD) in depression_codes then indicator17 = 1; 44534 if strip(DGNS_18_CD) in depression_codes then indicator18 = 1; 44535 if strip(DGNS_19_CD) in depression_codes then indicator19 = 1; 44536 if strip(DGNS_20_CD) in depression_codes then indicator20 = 1; 44537 if strip(DGNS_21_CD) in depression_codes then indicator21 = 1; 44538 if strip(DGNS_22_CD) in depression_codes then indicator22 = 1; 44539 if strip(DGNS_23_CD) in depression_codes then indicator23 = 1; 44540 if strip(DGNS_24_CD) in depression_codes then indicator24 = 1; 44541 if strip(DGNS_25_CD) in depression_codes then indicator25 = 1; 44542 44543 44544 44545 indicator_count=sum(of indicator1-indicator25); 44546 if indicator_count > 0 then indicator_all = 1; 44547 44548 44549 44550 44551 /****************************************************/ 44552 /* Nonalzhimers_MEDPAR*/ 44553 44554 *this part of the code will assign a 1 to any depression codes; 44555 44556 do i = 1 to dim(DGNS); 44557 if not missing(DGNS[i])then do; 44558 if strip(DGNS[i]) in nonalzhimers_codes then NONALZH_DEMEN_MEDPAR=1; 44559 end; 44560 end; 44561 44562 /* this part of the code will an a 0 to the depression indicator if there are any diagnosis 44562! codes*/ 44563 do i = 1 to dim(DGNS); 44564 if missing(NONALZH_DEMEN_MEDPAR) then do; 44565 if strip(DGNS[i]) in depression_codes then NONALZH_DEMEN_MEDPAR = 0; 44566 44567 if strip(DGNS[i]) in alzhimers_codes then NONALZH_DEMEN_MEDPAR = 0; 44568 if strip(DGNS[i]) in pneumonia_codes then NONALZH_DEMEN_MEDPAR = 0; 44569 if strip(DGNS[i]) in hf_codes then NONALZH_DEMEN_MEDPAR = 0; 44570 if strip(DGNS[i]) in prknsn_codes then NONALZH_DEMEN_MEDPAR = 0; 44571 if strip(DGNS[i]) in stroke_codes then NONALZH_DEMEN_MEDPAR = 0; 44572 if strip(DGNS[i]) in stroke_exclusion_codes then NONALZH_DEMEN_MEDPAR = 0; 44573 if strip(DGNS[i]) in anxiety_codes then NONALZH_DEMEN_MEDPAR = 0; 44574 if strip(DGNS[i]) in bipolar_codes then NONALZH_DEMEN_MEDPAR = 0; 44575 if strip(DGNS[i]) in TBI_codes then NONALZH_DEMEN_MEDPAR = 0; 44576 if strip(DGNS[i]) in DRUG_USE_CODES then NONALZH_DEMEN_MEDPAR = 0; 44577 if strip(DGNS[i]) in PSYCH_CODES then NONALZH_DEMEN_MEDPAR = 0; 44578 if strip(DGNS[i]) in OUD_CODES then NONALZH_DEMEN_MEDPAR = 0; 44579 end; 44580 end; 44581 44582 *assigning -9 to missing DGNS values; 44583 do i = 1 to dim(DGNS); 44584 if missing(NONALZH_DEMEN_MEDPAR) then do; 44585 if missing(DGNS[i]) then NONALZH_DEMEN_MEDPAR =-9; 44586 44587 end; 44588 end; 44589 44590 44591 44592 44593 44594 /* verifying*/ 44595 /* Initialize non-alzheimer indicators to 0 */ 44596 nonalzhimers_indicator_1 = 0; 44597 nonalzhimers_indicator_2 = 0; 44598 nonalzhimers_indicator_3 = 0; 44599 nonalzhimers_indicator_4 = 0; 44600 nonalzhimers_indicator_5 = 0; 44601 nonalzhimers_indicator_6 = 0; 44602 nonalzhimers_indicator_7 = 0; 44603 nonalzhimers_indicator_8 = 0; 44604 nonalzhimers_indicator_9 = 0; 44605 nonalzhimers_indicator_10 = 0; 44606 nonalzhimers_indicator_11 = 0; 44607 nonalzhimers_indicator_12 = 0; 44608 nonalzhimers_indicator_13 = 0; 44609 nonalzhimers_indicator_14 = 0; 44610 nonalzhimers_indicator_15 = 0; 44611 nonalzhimers_indicator_16 = 0; 44612 nonalzhimers_indicator_17 = 0; 44613 nonalzhimers_indicator_18 = 0; 44614 nonalzhimers_indicator_19 = 0; 44615 nonalzhimers_indicator_20 = 0; 44616 nonalzhimers_indicator_21 = 0; 44617 nonalzhimers_indicator_22 = 0; 44618 nonalzhimers_indicator_23 = 0; 44619 nonalzhimers_indicator_24 = 0; 44620 nonalzhimers_indicator_25 = 0; 44621 nonalzhimers_indicator_all = 0; 44622 44623 /* Check DGNS_X_CD variables against nonalzhimers_codes */ 44624 if strip(DGNS_1_CD) in nonalzhimers_codes then nonalzhimers_indicator_1 = 1; 44625 if strip(DGNS_2_CD) in nonalzhimers_codes then nonalzhimers_indicator_2 = 1; 44626 if strip(DGNS_3_CD) in nonalzhimers_codes then nonalzhimers_indicator_3 = 1; 44627 if strip(DGNS_4_CD) in nonalzhimers_codes then nonalzhimers_indicator_4 = 1; 44628 if strip(DGNS_5_CD) in nonalzhimers_codes then nonalzhimers_indicator_5 = 1; 44629 if strip(DGNS_6_CD) in nonalzhimers_codes then nonalzhimers_indicator_6 = 1; 44630 if strip(DGNS_7_CD) in nonalzhimers_codes then nonalzhimers_indicator_7 = 1; 44631 if strip(DGNS_8_CD) in nonalzhimers_codes then nonalzhimers_indicator_8 = 1; 44632 if strip(DGNS_9_CD) in nonalzhimers_codes then nonalzhimers_indicator_9 = 1; 44633 if strip(DGNS_10_CD) in nonalzhimers_codes then nonalzhimers_indicator_10 = 1; 44634 if strip(DGNS_11_CD) in nonalzhimers_codes then nonalzhimers_indicator_11 = 1; 44635 if strip(DGNS_12_CD) in nonalzhimers_codes then nonalzhimers_indicator_12 = 1; 44636 if strip(DGNS_13_CD) in nonalzhimers_codes then nonalzhimers_indicator_13 = 1; 44637 if strip(DGNS_14_CD) in nonalzhimers_codes then nonalzhimers_indicator_14 = 1; 44638 if strip(DGNS_15_CD) in nonalzhimers_codes then nonalzhimers_indicator_15 = 1; 44639 if strip(DGNS_16_CD) in nonalzhimers_codes then nonalzhimers_indicator_16 = 1; 44640 if strip(DGNS_17_CD) in nonalzhimers_codes then nonalzhimers_indicator_17 = 1; 44641 if strip(DGNS_18_CD) in nonalzhimers_codes then nonalzhimers_indicator_18 = 1; 44642 if strip(DGNS_19_CD) in nonalzhimers_codes then nonalzhimers_indicator_19 = 1; 44643 if strip(DGNS_20_CD) in nonalzhimers_codes then nonalzhimers_indicator_20 = 1; 44644 if strip(DGNS_21_CD) in nonalzhimers_codes then nonalzhimers_indicator_21 = 1; 44645 if strip(DGNS_22_CD) in nonalzhimers_codes then nonalzhimers_indicator_22 = 1; 44646 if strip(DGNS_23_CD) in nonalzhimers_codes then nonalzhimers_indicator_23 = 1; 44647 if strip(DGNS_24_CD) in nonalzhimers_codes then nonalzhimers_indicator_24 = 1; 44648 if strip(DGNS_25_CD) in nonalzhimers_codes then nonalzhimers_indicator_25 = 1; 44649 44650 /* Sum the indicators and check for at least one match */ 44651 nonalzhimers_indicator_count = sum(of nonalzhimers_indicator_1-nonalzhimers_indicator_25); 44652 if nonalzhimers_indicator_count > 0 then nonalzhimers_indicator_all = 1; 44653 44654 44655 44656 44657 *********************************************************************************************** 44657! ***** 44658 /* Alzhimers diagnosis*/ 44659 44660 /*Assign 1 to ALZH_MEDPAR for matches in alzhimers_codes; 44661 44662 44663 do i = 1 to dim(DGNS); 44664 if not missing(DGNS[i]) then do; 44665 if strip(DGNS[i]) in alzhimers_codes then ALZH_MEDPAR = 1; 44666 end; 44667 end; 44668 44669 /* Assign 0 to ALZH_MEDPAR for other diagnosis codes */ 44670 do i = 1 to dim(DGNS); 44671 if missing(ALZH_MEDPAR) then do; 44672 if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0; 44673 if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0; 44674 if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0; 44675 if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0; 44676 if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0; 44677 if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0; 44678 if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0; 44679 if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0; 44680 if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0; 44681 if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0; 44682 if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0; 44683 if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 44684 if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; 44685 end; 44686 end; 44687 44688 /* Assign -9 to ALZH_MEDPAR if all DGNS values are missing */ 44689 do i = 1 to dim(DGNS); 44690 if missing(ALZH_MEDPAR) then do; 44691 if missing(DGNS[i]) then ALZH_MEDPAR = -9; 44692 end; 44693 end; 44694 44695 44696 44697 /* verifying*/ 44698 /* Initialize alzheimer indicators to 0 */ 44699 alzh_indicator_1 = 0; 44700 alzh_indicator_2 = 0; 44701 alzh_indicator_3 = 0; 44702 alzh_indicator_4 = 0; 44703 alzh_indicator_5 = 0; 44704 alzh_indicator_6 = 0; 44705 alzh_indicator_7 = 0; 44706 alzh_indicator_8 = 0; 44707 alzh_indicator_9 = 0; 44708 alzh_indicator_10 = 0; 44709 alzh_indicator_11 = 0; 44710 alzh_indicator_12 = 0; 44711 alzh_indicator_13 = 0; 44712 alzh_indicator_14 = 0; 44713 alzh_indicator_15 = 0; 44714 alzh_indicator_16 = 0; 44715 alzh_indicator_17 = 0; 44716 alzh_indicator_18 = 0; 44717 alzh_indicator_19 = 0; 44718 alzh_indicator_20 = 0; 44719 alzh_indicator_21 = 0; 44720 alzh_indicator_22 = 0; 44721 alzh_indicator_23 = 0; 44722 alzh_indicator_24 = 0; 44723 alzh_indicator_25 = 0; 44724 alzh_indicator_all = 0; 44725 44726 /* Check DGNS_X_CD variables against alzhimers_codes */ 44727 if strip(DGNS_1_CD) in alzhimers_codes then alzh_indicator_1 = 1; 44728 if strip(DGNS_2_CD) in alzhimers_codes then alzh_indicator_2 = 1; 44729 if strip(DGNS_3_CD) in alzhimers_codes then alzh_indicator_3 = 1; 44730 if strip(DGNS_4_CD) in alzhimers_codes then alzh_indicator_4 = 1; 44731 if strip(DGNS_5_CD) in alzhimers_codes then alzh_indicator_5 = 1; 44732 if strip(DGNS_6_CD) in alzhimers_codes then alzh_indicator_6 = 1; 44733 if strip(DGNS_7_CD) in alzhimers_codes then alzh_indicator_7 = 1; 44734 if strip(DGNS_8_CD) in alzhimers_codes then alzh_indicator_8 = 1; 44735 if strip(DGNS_9_CD) in alzhimers_codes then alzh_indicator_9 = 1; 44736 if strip(DGNS_10_CD) in alzhimers_codes then alzh_indicator_10 = 1; 44737 if strip(DGNS_11_CD) in alzhimers_codes then alzh_indicator_11 = 1; 44738 if strip(DGNS_12_CD) in alzhimers_codes then alzh_indicator_12 = 1; 44739 if strip(DGNS_13_CD) in alzhimers_codes then alzh_indicator_13 = 1; 44740 if strip(DGNS_14_CD) in alzhimers_codes then alzh_indicator_14 = 1; 44741 if strip(DGNS_15_CD) in alzhimers_codes then alzh_indicator_15 = 1; 44742 if strip(DGNS_16_CD) in alzhimers_codes then alzh_indicator_16 = 1; 44743 if strip(DGNS_17_CD) in alzhimers_codes then alzh_indicator_17 = 1; 44744 if strip(DGNS_18_CD) in alzhimers_codes then alzh_indicator_18 = 1; 44745 if strip(DGNS_19_CD) in alzhimers_codes then alzh_indicator_19 = 1; 44746 if strip(DGNS_20_CD) in alzhimers_codes then alzh_indicator_20 = 1; 44747 if strip(DGNS_21_CD) in alzhimers_codes then alzh_indicator_21 = 1; 44748 if strip(DGNS_22_CD) in alzhimers_codes then alzh_indicator_22 = 1; 44749 if strip(DGNS_23_CD) in alzhimers_codes then alzh_indicator_23 = 1; 44750 if strip(DGNS_24_CD) in alzhimers_codes then alzh_indicator_24 = 1; 44751 if strip(DGNS_25_CD) in alzhimers_codes then alzh_indicator_25 = 1; 44752 44753 /* Sum the indicators and check for at least one match */ 44754 alzh_indicator_count = sum(of alzh_indicator_1-alzh_indicator_25); 44755 if alzh_indicator_count > 0 then alzh_indicator_all = 1; 44756 44757 %end; 44758 %mend medpar_analysis; 44759 %medpar_analysis; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2021_1 may be incomplete. When this step was stopped there were 0 observations and 763 variables. WARNING: Data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2021_1 was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 17:34.44 cpu time 29.42 seconds MPRINT(MEDPAR_ANALYSIS): data output.merged_medpar_mbsf_pdpn_2019_1; MPRINT(MEDPAR_ANALYSIS): set output.merged_medpar_mbsf_pdpn_2019_1; MPRINT(MEDPAR_ANALYSIS): array DGNS[25] $ DGNS_1_CD -- DGNS_25_CD; MPRINT(MEDPAR_ANALYSIS): DEPRESSION_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): NONALZH_DEMEN_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): ALZH_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): PNEUMO_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): hf_medpar =.; MPRINT(MEDPAR_ANALYSIS): PRKNSN_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): STROKE_TIA_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): ANXI_MEDICARE_MEDPAR =.; MPRINT(MEDPAR_ANALYSIS): BIPOLAR_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): TBI_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): DRUGS_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): SCHIOT_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): OUD_ANY_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): array depression_codes[50] $8 _temporary_ ('F0631', 'F0632', 'F310', 'F3110', 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 'F3161', 'F3162', 'F3163', 'F3164', 'F3171', 'F3173', 'F3175', 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 'F319', 'F320', 'F321', 'F322', 'F323', 'F324', 'F325', 'F328', 'F3289', 'F329', 'F32A', 'F330', 'F331', 'F332', 'F333', 'F3340', 'F3341', 'F3342', 'F338', 'F339', 'F340', 'F341', 'F4321', 'F4323'); MPRINT(MEDPAR_ANALYSIS): array nonalzhimers_codes[84] $8 _temporary_ ('F0150', 'F0151', 'F01511', 'F01518', 'F0152', 'F0153', 'F0154', 'F01A0', 'F01A11', 'F01A18', 'F01A2', 'F01A3', 'F01A4', 'F01B0', 'F01B11', 'F01B18', 'F01B2', 'F01B3', 'F01B4', 'F01C0', 'F01C11', 'F01C18', 'F01C2', 'F01C3', 'F01C4', 'F0280', 'F0281', 'F02811', 'F02818', 'F0282', 'F0283', 'F0284', 'F02A0', 'F02A11', 'F02A18', 'F02A2', 'F02A3', 'F02A4', 'F02B0', 'F02B11', 'F02B18', 'F02B2', 'F02B3', 'F02B4', 'F02C0', 'F02C11', 'F02C18', 'F02C2', 'F02C3', 'F02C4', 'F0390', 'F0391', 'F03911', 'F03918', 'F0392', 'F0393', 'F0394', 'F03A0', 'F03A11', 'F03A18', 'F03A2', 'F03A3', 'F03A4', 'F03B0', 'F03B11', 'F03B18', 'F03B2', 'F03B3', 'F03B4', 'F03C0', 'F03C11', 'F03C18', 'F03C2', 'F03C3', 'F03C4', 'F05', 'G138', 'G3101', 'G3109', 'G311', 'G312', 'G3183', 'G94', 'R4181'); MPRINT(MEDPAR_ANALYSIS): array alzhimers_codes[4] $8 _temporary_ ('G300', 'G301','G308', 'G309'); MPRINT(MEDPAR_ANALYSIS): array pneumonia_codes[93] $8 _temporary_( 'A0103', 'A0222', 'A065', 'A202', 'A212', 'A221', 'A310', 'A3701', 'A3711', 'A3781', 'A3791', 'A403', 'A420', 'A430', 'A481', 'A5004', 'A5484', 'B012', 'B052', 'B0681', 'B371', 'B380', 'B382', 'B390', 'B392', 'B400', 'B402', 'B410', 'B583', 'B59', 'B664', 'B671', 'B7781', 'B953', 'B960', 'B961', 'J09X1', 'J1000', 'J1001', 'J1008', 'J1100', 'J1108', 'J120', 'J121', 'J122', 'J123', 'J1281', 'J1282', 'J1289', 'J129', 'J13', 'J14', 'J150', 'J151', 'J1520', 'J15211', 'J15212', 'J1529', 'J153', 'J154', 'J155', 'J156', 'J1561', 'J1569', 'J157', 'J158', 'J159', 'J160', 'J168', 'J17', 'J180', 'J181', 'J182', 'J188', 'J189', 'J200', 'J84111', 'J84116', 'J84117', 'J84178', 'J842', 'J851', 'J95851', 'P230', 'P231', 'P232', 'P233', 'P234', 'P235', 'P236', 'P238', 'P239', 'Z8701'); MPRINT(MEDPAR_ANALYSIS): array hf_codes[34] $8 _temporary_ ( 'I0981', 'I110', 'I130', 'I132', 'I420', 'I425', 'I426', 'I427', 'I428', 'I43', 'I501', 'I5020', 'I5021', 'I5022', 'I5023', 'I5030', 'I5031', 'I5032', 'I5033', 'I5040', 'I5041', 'I5042', 'I5043', 'I50810', 'I50811', 'I50812', 'I50813', 'I50814', 'I5082', 'I5083', 'I5084', 'I5089', 'I509', 'P290'); MPRINT(MEDPAR_ANALYSIS): array prknsn_codes[13] $8 _temporary_ ( 'G20', 'G20A1', 'G20A2', 'G20B1', 'G20B2', 'G20C', 'G2111', 'G2119', 'G213', 'G214', 'G218', 'G219', 'G3183'); MPRINT(MEDPAR_ANALYSIS): array stroke_codes[150] $8 _temporary_ ( 'G450', 'G451', 'G452', 'G453', 'G458', 'G459', 'G460', 'G461', 'G462', 'G463', 'G464', 'G465', 'G466', 'G467', 'G468', 'G9731', 'G9732', 'I6000', 'I6001', 'I6002', 'I6010', 'I6011', 'I6012', 'I602', 'I6020', 'I6021', 'I6022', 'I6030', 'I6031', 'I6032', 'I604', 'I6050', 'I6051', 'I6052', 'I606', 'I607', 'I608', 'I609', 'I610', 'I611', 'I612', 'I613', 'I614', 'I615', 'I616', 'I618', 'I619', 'I6200', 'I6201', 'I6202', 'I629', 'I6300', 'I63011', 'I63012', 'I63013', 'I63019', 'I6302', 'I63031', 'I63032', 'I63033', 'I63039', 'I6309', 'I6310', 'I63111', 'I63112', 'I63113', 'I63119', 'I6312', 'I63131', 'I63132', 'I63133', 'I63139', 'I6319', 'I6320', 'I63211', 'I63212', 'I63213', 'I63219', 'I6322', 'I63231', 'I63232', 'I63233', 'I63239', 'I6329', 'I6330', 'I63311', 'I63312', 'I63313', 'I63319', 'I63321', 'I63322', 'I63323', 'I63329', 'I63331', 'I63332', 'I63333', 'I63339', 'I63341', 'I63342', 'I63343', 'I63349', 'I6339', 'I6340', 'I63411', 'I63412', 'I63413', 'I63419', 'I63421', 'I63422', 'I63423', 'I63429', 'I63431', 'I63432', 'I63433', 'I63439', 'I63441', 'I63442', 'I63443', 'I63449', 'I6349', 'I6350', 'I63511', 'I63512', 'I63513', 'I63519', 'I63521', 'I63522', 'I63523', 'I63529', 'I63531', 'I63532', 'I63533', 'I63539', 'I63541', 'I63542', 'I63543', 'I63549', 'I6359', 'I636', 'I638', 'I6381', 'I6389', 'I639', 'I67841', 'I67848', 'I6789', 'I97810', 'I97811', 'I97820', 'I97821'); MPRINT(MEDPAR_ANALYSIS): array stroke_exclusion_codes[119] $8 _temporary_ ( 'S06340A', 'S06341A', 'S06342A', 'S06343A', 'S06344A', 'S06345A', 'S06346A', 'S06347A', 'S06348A', 'S0634AA', 'S06349A', 'S06350A', 'S06351A', 'S06352A', 'S06353A', 'S06354A', 'S06355A', 'S06356A', 'S06357A', 'S06358A', 'S0635AA', 'S06359A', 'S06360A', 'S06361A', 'S06362A', 'S06363A', 'S06364A', 'S06365A', 'S06366A', 'S06367A', 'S06368A', 'S0636AA', 'S06369A', 'S06370A', 'S06371A', 'S06372A', 'S06373A', 'S06374A', 'S06375A', 'S06376A', 'S06377A', 'S06378A', 'S0637AA', 'S06379A', 'S06380A', 'S06381A', 'S06382A', 'S06383A', 'S06384A', 'S06385A', 'S06386A', 'S06387A', 'S06388A', 'S0638AA', 'S06389A', 'S065X0A', 'S065X1A', 'S065X2A', 'S065X3A', 'S065X4A', 'S065X5A', 'S065X6A', 'S065X7A', 'S065X8A', 'S065XAA', 'S065X9A', 'S066X0A', 'S066X1A', 'S066X2A', 'S066X3A', 'S066X4A', 'S066X5A', 'S066X6A', 'S066X7A', 'S066X8A', 'S066XAA', 'S066X9A', 'S06810A', 'S06811A', 'S06812A', 'S06813A', 'S06814A', 'S06815A', 'S06816A', 'S06817A', 'S06818A', 'S0681AA', 'S06819A', 'S06820A', 'S06821A', 'S06822A', 'S06823A', 'S06824A', 'S06825A', 'S06826A', 'S06827A', 'S06828A', 'S0682AA', 'S06829A', 'S06890A', 'S06891A', 'S06892A', 'S06893A', 'S06894A', 'S06895A', 'S06896A', 'S06897A', 'S06898A', 'S0689AA', 'S06899A', 'S069X0A', 'S069X1A', 'S069X2A', 'S069X3A', 'S069X4A', 'S069X5A', 'S069X6A', 'S069X7A', 'S069X8A'); MPRINT(MEDPAR_ANALYSIS): array anxiety_codes[49] $8 _temporary_ ( 'F064', 'F4000', 'F4001', 'F4002', 'F4010', 'F4011', 'F40210', 'F40218', 'F40220', 'F40228', 'F40230', 'F40231', 'F40232', 'F40233', 'F40240', 'F40241', 'F40242', 'F40243', 'F40248', 'F40290', 'F40291', 'F40298', 'F408', 'F409', 'F410', 'F411', 'F413', 'F418', 'F419', 'F42', 'F422', 'F423', 'F424', 'F428', 'F429', 'F430', 'F4310', 'F4311', 'F4312', 'F449', 'F458', 'F488', 'F489', 'F938', 'F99', 'R452', 'R455', 'R456', 'R457'); MPRINT(MEDPAR_ANALYSIS): array bipolar_codes[42] $8 _temporary_ ( 'F3010', 'F3011', 'F3012', 'F3013', 'F302', 'F303', 'F304', 'F308', 'F309', 'F310', 'F3110', 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 'F3161', 'F3162', 'F3163', 'F3164', 'F3170', 'F3171', 'F3172', 'F3173', 'F3174', 'F3175', 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 'F319', 'F338', 'F3481', 'F3489', 'F349', 'F39'); MPRINT(MEDPAR_ANALYSIS): array TBI_codes [262] $8 _temporary_( 'F070', 'F0781', 'F0789', 'F482', 'S04011S', 'S04012S', 'S04019S', 'S0402XS', 'S04031S', 'S04032S', 'S04039S', 'S04041S', 'S04042S', 'S04049S', 'S0410XS', 'S0411XS', 'S0412XS', 'S0420XS', 'S0421XS', 'S0422XS', 'S0430XS', 'S0431XS', 'S0432XS', 'S0440XS', 'S0441XS', 'S0442XS', 'S0450XS', 'S0451XS', 'S0452XS', 'S0460XS', 'S0461XS', 'S0462XS', 'S0470XS', 'S0471XS', 'S0472XS', 'S04811S', 'S04812S', 'S04819S', 'S04891S', 'S04892S', 'S04899S', 'S049XXS', 'S060X0S', 'S060X1S', 'S060X2S', 'S060X3S', 'S060X4S', 'S060X5S', 'S060X6S', 'S060X7S', 'S060X8S', 'S060XAS', 'S060X9S', 'S061X0S', 'S061X1S', 'S061X2S', 'S061X3S', 'S061X4S', 'S061X5S', 'S061X6S', 'S061X7S', 'S061X8S', 'S061XAS', 'S061X9S', 'S062X0S', 'S062X1S', 'S062X2S', 'S062X3S', 'S062X4S', 'S062X5S', 'S062X6S', 'S062X7S', 'S062X8S', 'S062XAS', 'S062X9S', 'S06300S', 'S06301S', 'S06302S', 'S06303S', 'S06304S', 'S06305S', 'S06306S', 'S06307S', 'S06308S', 'S0630AS', 'S06309S', 'S06310S', 'S06311S', 'S06312S', 'S06313S', 'S06314S', 'S06315S', 'S06316S', 'S06317S', 'S06318S', 'S0631AS', 'S06319S', 'S06320S', 'S06321S', 'S06322S', 'S06323S', 'S06324S', 'S06325S', 'S06326S', 'S06327S', 'S06328S', 'S0632AS', 'S06329S', 'S06330S', 'S06331S', 'S06332S', 'S06333S', 'S06334S', 'S06335S', 'S06336S', 'S06337S', 'S06338S', 'S0633AS', 'S06339S', 'S06340S', 'S06341S', 'S06342S', 'S06343S', 'S06344S', 'S06345S', 'S06346S', 'S06347S', 'S06348S', 'S0634AS', 'S06349S', 'S06350S', 'S06351S', 'S06352S', 'S06353S', 'S06354S', 'S06355S', 'S06356S', 'S06357S', 'S06358S', 'S0635AS', 'S06359S', 'S06360S', 'S06361S', 'S06362S', 'S06363S', 'S06364S', 'S06365S', 'S06366S', 'S06367S', 'S06368S', 'S0636AS', 'S06369S', 'S06370S', 'S06371S', 'S06372S', 'S06373S', 'S06374S', 'S06375S', 'S06376S', 'S06377S', 'S06378S', 'S0637AS', 'S06379S', 'S06380S', 'S06381S', 'S06382S', 'S06383S', 'S06384S', 'S06385S', 'S06386S', 'S06387S', 'S06388S', 'S0638AS', 'S06389S', 'S064X0S', 'S064X1S', 'S064X2S', 'S064X3S', 'S064X4S', 'S064X5S', 'S064X6S', 'S064X7S', 'S064X8S', 'S064XAS', 'S064X9S', 'S065X0S', 'S065X1S', 'S065X2S', 'S065X3S', 'S065X4S', 'S065X5S', 'S065X6S', 'S065X7S', 'S065X8S', 'S065XAS', 'S065X9S', 'S066X0S', 'S066X1S', 'S066X2S', 'S066X3S', 'S066X4S', 'S066X5S', 'S066X6S', 'S066X7S', 'S066X8S', 'S066XAS', 'S066X9S', 'S06810S', 'S06811S', 'S06812S', 'S06813S', 'S06814S', 'S06815S', 'S06816S', 'S06817S', 'S06818S', 'S0681AS', 'S06819S', 'S06820S', 'S06821S', 'S06822S', 'S06823S', 'S06824S', 'S06825S', 'S06826S', 'S06827S', 'S06828S', 'S0682AS', 'S06829S', 'S068A0S', 'S068A1S', 'S068A2S', 'S068A3S', 'S068A4S', 'S068A5S', 'S068A6S', 'S068AAS', 'S068A9S', 'S06890S', 'S06891S', 'S06892S', 'S06893S', 'S06894S', 'S06895S', 'S06896S', 'S06897S', 'S06898S', 'S0689AS', 'S06899S', 'S069X0S', 'S069X1S', 'S069X2S', 'S069X3S', 'S069X4S', 'S069X5S', 'S069X6S', 'S069X7S', 'S069X8S', 'S069XAS', 'S069X9S', 'S06A0XS', 'S06A1XS'); MPRINT(MEDPAR_ANALYSIS): array DRUG_USE_CODES[133] $8 _temporary_ ('HZ2ZZZZ', 'HZ30ZZZ', 'HZ31ZZZ', 'HZ32ZZZ', 'HZ33ZZZ', 'HZ34ZZZ', 'HZ35ZZZ', 'HZ36ZZZ', 'HZ37ZZZ', 'HZ38ZZZ', 'HZ39ZZZ', 'HZ3BZZZ', 'HZ40ZZZ', 'HZ93ZZZ', 'HZ96ZZZ' 'F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 'F1123', 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 'F11920', 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 'F11982', 'F11988', 'F1199', 'F1210', 'F12120', 'F12121', 'F12122', 'F12129', 'F1213', 'F12150', 'F12151', 'F12159', 'F12180', 'F12188', 'F1219', 'F1220', 'F12220', 'F12221', 'F12222', 'F12229', 'F12250', 'F1629', 'F1690', 'F16920', 'F16921', 'F16929', 'F1694', 'F16950', 'F16951', 'F16959', 'F16980', 'F16983', 'F16988', 'F1699', 'F17203', 'F17208', 'F17209', 'F17213', 'F17218', 'F17219', 'F17223', 'F17228', 'F17229', 'F17293', 'F17298', 'F17299', 'F1810', 'F18120', 'F18121', 'F18129', 'F1814', 'F18150', 'F18151', 'F18159', 'F1817', 'F18180', 'F18188', 'F1819', 'F1820', 'F18220', 'F18221', 'F18229', 'F1824', 'F18250', 'F18251', 'F18259', 'F1827', 'F18280', 'F18288', 'F1829', 'F1890', 'F18920', 'F18921', 'F18929', 'F1894', 'F18950', 'F18951', 'F18959', 'F1897'); MPRINT(MEDPAR_ANALYSIS): array PSYCH_CODES[12] $8 _temporary_ ('F200', 'F201', 'F202', 'F203', 'F205', 'F2081', 'F2089', 'F209', 'F250', 'F251', 'F258', 'F259'); MPRINT(MEDPAR_ANALYSIS): array OUD_codes[197] $8 _temporary_ ('F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 'F1123', 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 'F11920', 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 'F11982', 'F11988', 'F1199', 'HZ81ZZZ', 'HZ84ZZZ', 'HZ85ZZZ', 'HZ86ZZZ', 'HZ91ZZZ', 'HZ94ZZZ', 'HZ95ZZZ', 'HZ96ZZZ', 'T400X1A', 'T400X1D', 'T400X1S', 'T400X2A', 'T400X2D', 'T400X2S', 'T400X3A', 'T400X3D', 'T400X3S', 'T400X4A', 'T400X4D', 'T400X4S', 'T400X5A', 'T400X5D', 'T400X5S', 'T401X1A', 'T401X1D', 'T401X1S', 'T401X2A', 'T401X2D', 'T401X2S', 'T401X3A', 'T401X3D', 'T401X3S', 'T401X4A', 'T401X4D', 'T401X4S', 'T402X1A', 'T402X1D', 'T402X1S', 'T402X2A', 'T402X2D', 'T402X2S', 'T402X3A', 'T402X3D', 'T402X3S', 'T402X4A', 'T402X4D', 'T402X4S', 'T402X5A', 'T402X5D', 'T402X5S', 'T403X1A', 'T403X1D', 'T403X1S', 'T403X2A', 'T403X2D', 'T403X2S', 'T403X3A', 'T403X3D', 'T403X3S', 'T403X4A', 'T403X4D', 'T403X4S', 'T403X5A', 'T403X5D', 'T403X5S', 'T40411A', 'T40411D', 'T40411S', 'T40412A', 'T40412D', 'T40412S', 'T40413A', 'T40413D', 'T40413S', 'T40414A', 'T40414D', 'T40414S', 'T40415A', 'T40415D', 'T40415S', 'T40421A', 'T40421D', 'T40421S', 'T40422A', 'T40422D', 'T40422S', 'T40423A', 'T40423D', 'T40423S', 'T40424A', 'T40424D', 'T40424S', 'T40425A', 'T40425D', 'T40425S', 'T40491A', 'T40491D', 'T40491S', 'T40492A', 'T40492D', 'T40492S', 'T40493A', 'T40493D', 'T40493S', 'T40494A', 'T40494D', 'T40494S', 'T40495A', 'T40495D', 'T40495S', 'T404X1A', 'T404X1D', 'T404X1S', 'T404X2A', 'T404X2D', 'T404X2S', 'T404X3A', 'T404X3D', 'T404X3S', 'T404X4A', 'T404X4D', 'T404X4S', 'T404X5A', 'T404X5D', 'T404X5S', 'T40601A', 'T40601D', 'T40601S', 'T40602A', 'T40602D', 'T40602S', 'T40603A', 'T40603D', 'T40603S', 'T40604A', 'T40604D', 'T40604S', 'T40605A', 'T40605D', 'T40605S', 'T40691A', 'T40691D', 'T40691S', 'T40692A', 'T40692D', 'T40692S', 'T40693A', 'T40693D', 'T40693S', 'T40694A', 'T40694D', 'T40694S', 'T40695A', 'T40695D', 'T40695S'); MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if not missing(DGNS[i])then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then DEPRESSION_MEDPAR=1; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(DEPRESSION_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then DEPRESSION_MEDPAR =0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in alzhimers_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then DEPRESSION_MEDPAR= 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): *assigning -9 to missing DGNS values; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(DEPRESSION_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then DEPRESSION_MEDPAR =-9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): * end; MPRINT(MEDPAR_ANALYSIS): indicator1 = 0; MPRINT(MEDPAR_ANALYSIS): indicator2 = 0; MPRINT(MEDPAR_ANALYSIS): indicator3 = 0; MPRINT(MEDPAR_ANALYSIS): indicator4 = 0; MPRINT(MEDPAR_ANALYSIS): indicator5 = 0; MPRINT(MEDPAR_ANALYSIS): indicator6 = 0; MPRINT(MEDPAR_ANALYSIS): indicator7 = 0; MPRINT(MEDPAR_ANALYSIS): indicator8 = 0; MPRINT(MEDPAR_ANALYSIS): indicator9 = 0; MPRINT(MEDPAR_ANALYSIS): indicator10 = 0; MPRINT(MEDPAR_ANALYSIS): indicator11 = 0; MPRINT(MEDPAR_ANALYSIS): indicator12 = 0; MPRINT(MEDPAR_ANALYSIS): indicator13 = 0; MPRINT(MEDPAR_ANALYSIS): indicator14 = 0; MPRINT(MEDPAR_ANALYSIS): indicator15 = 0; MPRINT(MEDPAR_ANALYSIS): indicator16 = 0; MPRINT(MEDPAR_ANALYSIS): indicator17 = 0; MPRINT(MEDPAR_ANALYSIS): indicator18 = 0; MPRINT(MEDPAR_ANALYSIS): indicator19 = 0; MPRINT(MEDPAR_ANALYSIS): indicator20 = 0; MPRINT(MEDPAR_ANALYSIS): indicator21 = 0; MPRINT(MEDPAR_ANALYSIS): indicator22 = 0; MPRINT(MEDPAR_ANALYSIS): indicator23 = 0; MPRINT(MEDPAR_ANALYSIS): indicator24 = 0; MPRINT(MEDPAR_ANALYSIS): indicator25 = 0; MPRINT(MEDPAR_ANALYSIS): indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in depression_codes then indicator1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in depression_codes then indicator2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in depression_codes then indicator3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in depression_codes then indicator4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in depression_codes then indicator5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in depression_codes then indicator6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in depression_codes then indicator7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in depression_codes then indicator8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in depression_codes then indicator9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in depression_codes then indicator10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in depression_codes then indicator11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in depression_codes then indicator12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in depression_codes then indicator13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in depression_codes then indicator14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in depression_codes then indicator15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in depression_codes then indicator16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in depression_codes then indicator17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in depression_codes then indicator18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in depression_codes then indicator19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in depression_codes then indicator20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in depression_codes then indicator21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in depression_codes then indicator22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in depression_codes then indicator23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in depression_codes then indicator24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in depression_codes then indicator25 = 1; MPRINT(MEDPAR_ANALYSIS): indicator_count=sum(of indicator1-indicator25); MPRINT(MEDPAR_ANALYSIS): if indicator_count > 0 then indicator_all = 1; MPRINT(MEDPAR_ANALYSIS): *this part of the code will assign a 1 to any depression codes; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if not missing(DGNS[i])then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then NONALZH_DEMEN_MEDPAR=1; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(NONALZH_DEMEN_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in alzhimers_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): *assigning -9 to missing DGNS values; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(NONALZH_DEMEN_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then NONALZH_DEMEN_MEDPAR =-9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_1 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_2 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_3 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_4 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_5 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_6 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_7 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_8 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_9 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_10 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_11 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_12 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_13 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_14 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_15 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_16 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_17 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_18 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_19 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_20 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_21 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_22 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_23 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_24 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_25 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in nonalzhimers_codes then nonalzhimers_indicator_1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in nonalzhimers_codes then nonalzhimers_indicator_2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in nonalzhimers_codes then nonalzhimers_indicator_3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in nonalzhimers_codes then nonalzhimers_indicator_4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in nonalzhimers_codes then nonalzhimers_indicator_5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in nonalzhimers_codes then nonalzhimers_indicator_6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in nonalzhimers_codes then nonalzhimers_indicator_7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in nonalzhimers_codes then nonalzhimers_indicator_8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in nonalzhimers_codes then nonalzhimers_indicator_9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in nonalzhimers_codes then nonalzhimers_indicator_10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in nonalzhimers_codes then nonalzhimers_indicator_11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in nonalzhimers_codes then nonalzhimers_indicator_12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in nonalzhimers_codes then nonalzhimers_indicator_13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in nonalzhimers_codes then nonalzhimers_indicator_14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in nonalzhimers_codes then nonalzhimers_indicator_15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in nonalzhimers_codes then nonalzhimers_indicator_16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in nonalzhimers_codes then nonalzhimers_indicator_17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in nonalzhimers_codes then nonalzhimers_indicator_18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in nonalzhimers_codes then nonalzhimers_indicator_19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in nonalzhimers_codes then nonalzhimers_indicator_20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in nonalzhimers_codes then nonalzhimers_indicator_21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in nonalzhimers_codes then nonalzhimers_indicator_22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in nonalzhimers_codes then nonalzhimers_indicator_23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in nonalzhimers_codes then nonalzhimers_indicator_24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in nonalzhimers_codes then nonalzhimers_indicator_25 = 1; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_count = sum(of nonalzhimers_indicator_1-nonalzhimers_indicator_25); MPRINT(MEDPAR_ANALYSIS): if nonalzhimers_indicator_count > 0 then nonalzhimers_indicator_all = 1; MPRINT(MEDPAR_ANALYSIS): **************************************************************************************************** do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(ALZH_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0; NOTE: Line generated by the invoked macro "MEDPAR_ANALYSIS". 127 then ALZH_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 127 ! if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; end; end; do i = 1 to dim(DGNS) --- 161 127 ! ; if missing(ALZH_MEDPAR) then do; if missing(DGNS[i]) MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(ALZH_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then ALZH_MEDPAR = -9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_1 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_2 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_3 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_4 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_5 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_6 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_7 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_8 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_9 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_10 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_11 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_12 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_13 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_14 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_15 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_16 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_17 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_18 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_19 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_20 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_21 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_22 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_23 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_24 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_25 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in alzhimers_codes then alzh_indicator_1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in alzhimers_codes then alzh_indicator_2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in alzhimers_codes then alzh_indicator_3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in alzhimers_codes then alzh_indicator_4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in alzhimers_codes then alzh_indicator_5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in alzhimers_codes then alzh_indicator_6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in alzhimers_codes then alzh_indicator_7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in alzhimers_codes then alzh_indicator_8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in alzhimers_codes then alzh_indicator_9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in alzhimers_codes then alzh_indicator_10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in alzhimers_codes then alzh_indicator_11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in alzhimers_codes then alzh_indicator_12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in alzhimers_codes then alzh_indicator_13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in alzhimers_codes then alzh_indicator_14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in alzhimers_codes then alzh_indicator_15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in alzhimers_codes then alzh_indicator_16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in alzhimers_codes then alzh_indicator_17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in alzhimers_codes then alzh_indicator_18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in alzhimers_codes then alzh_indicator_19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in alzhimers_codes then alzh_indicator_20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in alzhimers_codes then alzh_indicator_21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in alzhimers_codes then alzh_indicator_22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in alzhimers_codes then alzh_indicator_23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in alzhimers_codes then alzh_indicator_24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in alzhimers_codes then alzh_indicator_25 = 1; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_count = sum(of alzh_indicator_1-alzh_indicator_25); MPRINT(MEDPAR_ANALYSIS): if alzh_indicator_count > 0 then alzh_indicator_all = 1; ERROR 161-185: No matching DO/SELECT statement. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2019_1 may be incomplete. When this step was stopped there were 0 observations and 817 variables. WARNING: Data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2019_1 was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.10 seconds cpu time 0.11 seconds MPRINT(MEDPAR_ANALYSIS): data output.merged_medpar_mbsf_pdpn_2020_1; MPRINT(MEDPAR_ANALYSIS): set output.merged_medpar_mbsf_pdpn_2020_1; MPRINT(MEDPAR_ANALYSIS): array DGNS[25] $ DGNS_1_CD -- DGNS_25_CD; MPRINT(MEDPAR_ANALYSIS): DEPRESSION_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): NONALZH_DEMEN_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): ALZH_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): PNEUMO_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): hf_medpar =.; MPRINT(MEDPAR_ANALYSIS): PRKNSN_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): STROKE_TIA_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): ANXI_MEDICARE_MEDPAR =.; MPRINT(MEDPAR_ANALYSIS): BIPOLAR_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): TBI_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): DRUGS_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): SCHIOT_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): OUD_ANY_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): array depression_codes[50] $8 _temporary_ ('F0631', 'F0632', 'F310', 'F3110', 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 'F3161', 'F3162', 'F3163', 'F3164', 'F3171', 'F3173', 'F3175', 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 'F319', 'F320', 'F321', 'F322', 'F323', 'F324', 'F325', 'F328', 'F3289', 'F329', 'F32A', 'F330', 'F331', 'F332', 'F333', 'F3340', 'F3341', 'F3342', 'F338', 'F339', 'F340', 'F341', 'F4321', 'F4323'); MPRINT(MEDPAR_ANALYSIS): array nonalzhimers_codes[84] $8 _temporary_ ('F0150', 'F0151', 'F01511', 'F01518', 'F0152', 'F0153', 'F0154', 'F01A0', 'F01A11', 'F01A18', 'F01A2', 'F01A3', 'F01A4', 'F01B0', 'F01B11', 'F01B18', 'F01B2', 'F01B3', 'F01B4', 'F01C0', 'F01C11', 'F01C18', 'F01C2', 'F01C3', 'F01C4', 'F0280', 'F0281', 'F02811', 'F02818', 'F0282', 'F0283', 'F0284', 'F02A0', 'F02A11', 'F02A18', 'F02A2', 'F02A3', 'F02A4', 'F02B0', 'F02B11', 'F02B18', 'F02B2', 'F02B3', 'F02B4', 'F02C0', 'F02C11', 'F02C18', 'F02C2', 'F02C3', 'F02C4', 'F0390', 'F0391', 'F03911', 'F03918', 'F0392', 'F0393', 'F0394', 'F03A0', 'F03A11', 'F03A18', 'F03A2', 'F03A3', 'F03A4', 'F03B0', 'F03B11', 'F03B18', 'F03B2', 'F03B3', 'F03B4', 'F03C0', 'F03C11', 'F03C18', 'F03C2', 'F03C3', 'F03C4', 'F05', 'G138', 'G3101', 'G3109', 'G311', 'G312', 'G3183', 'G94', 'R4181'); MPRINT(MEDPAR_ANALYSIS): array alzhimers_codes[4] $8 _temporary_ ('G300', 'G301','G308', 'G309'); MPRINT(MEDPAR_ANALYSIS): array pneumonia_codes[93] $8 _temporary_( 'A0103', 'A0222', 'A065', 'A202', 'A212', 'A221', 'A310', 'A3701', 'A3711', 'A3781', 'A3791', 'A403', 'A420', 'A430', 'A481', 'A5004', 'A5484', 'B012', 'B052', 'B0681', 'B371', 'B380', 'B382', 'B390', 'B392', 'B400', 'B402', 'B410', 'B583', 'B59', 'B664', 'B671', 'B7781', 'B953', 'B960', 'B961', 'J09X1', 'J1000', 'J1001', 'J1008', 'J1100', 'J1108', 'J120', 'J121', 'J122', 'J123', 'J1281', 'J1282', 'J1289', 'J129', 'J13', 'J14', 'J150', 'J151', 'J1520', 'J15211', 'J15212', 'J1529', 'J153', 'J154', 'J155', 'J156', 'J1561', 'J1569', 'J157', 'J158', 'J159', 'J160', 'J168', 'J17', 'J180', 'J181', 'J182', 'J188', 'J189', 'J200', 'J84111', 'J84116', 'J84117', 'J84178', 'J842', 'J851', 'J95851', 'P230', 'P231', 'P232', 'P233', 'P234', 'P235', 'P236', 'P238', 'P239', 'Z8701'); MPRINT(MEDPAR_ANALYSIS): array hf_codes[34] $8 _temporary_ ( 'I0981', 'I110', 'I130', 'I132', 'I420', 'I425', 'I426', 'I427', 'I428', 'I43', 'I501', 'I5020', 'I5021', 'I5022', 'I5023', 'I5030', 'I5031', 'I5032', 'I5033', 'I5040', 'I5041', 'I5042', 'I5043', 'I50810', 'I50811', 'I50812', 'I50813', 'I50814', 'I5082', 'I5083', 'I5084', 'I5089', 'I509', 'P290'); MPRINT(MEDPAR_ANALYSIS): array prknsn_codes[13] $8 _temporary_ ( 'G20', 'G20A1', 'G20A2', 'G20B1', 'G20B2', 'G20C', 'G2111', 'G2119', 'G213', 'G214', 'G218', 'G219', 'G3183'); MPRINT(MEDPAR_ANALYSIS): array stroke_codes[150] $8 _temporary_ ( 'G450', 'G451', 'G452', 'G453', 'G458', 'G459', 'G460', 'G461', 'G462', 'G463', 'G464', 'G465', 'G466', 'G467', 'G468', 'G9731', 'G9732', 'I6000', 'I6001', 'I6002', 'I6010', 'I6011', 'I6012', 'I602', 'I6020', 'I6021', 'I6022', 'I6030', 'I6031', 'I6032', 'I604', 'I6050', 'I6051', 'I6052', 'I606', 'I607', 'I608', 'I609', 'I610', 'I611', 'I612', 'I613', 'I614', 'I615', 'I616', 'I618', 'I619', 'I6200', 'I6201', 'I6202', 'I629', 'I6300', 'I63011', 'I63012', 'I63013', 'I63019', 'I6302', 'I63031', 'I63032', 'I63033', 'I63039', 'I6309', 'I6310', 'I63111', 'I63112', 'I63113', 'I63119', 'I6312', 'I63131', 'I63132', 'I63133', 'I63139', 'I6319', 'I6320', 'I63211', 'I63212', 'I63213', 'I63219', 'I6322', 'I63231', 'I63232', 'I63233', 'I63239', 'I6329', 'I6330', 'I63311', 'I63312', 'I63313', 'I63319', 'I63321', 'I63322', 'I63323', 'I63329', 'I63331', 'I63332', 'I63333', 'I63339', 'I63341', 'I63342', 'I63343', 'I63349', 'I6339', 'I6340', 'I63411', 'I63412', 'I63413', 'I63419', 'I63421', 'I63422', 'I63423', 'I63429', 'I63431', 'I63432', 'I63433', 'I63439', 'I63441', 'I63442', 'I63443', 'I63449', 'I6349', 'I6350', 'I63511', 'I63512', 'I63513', 'I63519', 'I63521', 'I63522', 'I63523', 'I63529', 'I63531', 'I63532', 'I63533', 'I63539', 'I63541', 'I63542', 'I63543', 'I63549', 'I6359', 'I636', 'I638', 'I6381', 'I6389', 'I639', 'I67841', 'I67848', 'I6789', 'I97810', 'I97811', 'I97820', 'I97821'); MPRINT(MEDPAR_ANALYSIS): array stroke_exclusion_codes[119] $8 _temporary_ ( 'S06340A', 'S06341A', 'S06342A', 'S06343A', 'S06344A', 'S06345A', 'S06346A', 'S06347A', 'S06348A', 'S0634AA', 'S06349A', 'S06350A', 'S06351A', 'S06352A', 'S06353A', 'S06354A', 'S06355A', 'S06356A', 'S06357A', 'S06358A', 'S0635AA', 'S06359A', 'S06360A', 'S06361A', 'S06362A', 'S06363A', 'S06364A', 'S06365A', 'S06366A', 'S06367A', 'S06368A', 'S0636AA', 'S06369A', 'S06370A', 'S06371A', 'S06372A', 'S06373A', 'S06374A', 'S06375A', 'S06376A', 'S06377A', 'S06378A', 'S0637AA', 'S06379A', 'S06380A', 'S06381A', 'S06382A', 'S06383A', 'S06384A', 'S06385A', 'S06386A', 'S06387A', 'S06388A', 'S0638AA', 'S06389A', 'S065X0A', 'S065X1A', 'S065X2A', 'S065X3A', 'S065X4A', 'S065X5A', 'S065X6A', 'S065X7A', 'S065X8A', 'S065XAA', 'S065X9A', 'S066X0A', 'S066X1A', 'S066X2A', 'S066X3A', 'S066X4A', 'S066X5A', 'S066X6A', 'S066X7A', 'S066X8A', 'S066XAA', 'S066X9A', 'S06810A', 'S06811A', 'S06812A', 'S06813A', 'S06814A', 'S06815A', 'S06816A', 'S06817A', 'S06818A', 'S0681AA', 'S06819A', 'S06820A', 'S06821A', 'S06822A', 'S06823A', 'S06824A', 'S06825A', 'S06826A', 'S06827A', 'S06828A', 'S0682AA', 'S06829A', 'S06890A', 'S06891A', 'S06892A', 'S06893A', 'S06894A', 'S06895A', 'S06896A', 'S06897A', 'S06898A', 'S0689AA', 'S06899A', 'S069X0A', 'S069X1A', 'S069X2A', 'S069X3A', 'S069X4A', 'S069X5A', 'S069X6A', 'S069X7A', 'S069X8A'); MPRINT(MEDPAR_ANALYSIS): array anxiety_codes[49] $8 _temporary_ ( 'F064', 'F4000', 'F4001', 'F4002', 'F4010', 'F4011', 'F40210', 'F40218', 'F40220', 'F40228', 'F40230', 'F40231', 'F40232', 'F40233', 'F40240', 'F40241', 'F40242', 'F40243', 'F40248', 'F40290', 'F40291', 'F40298', 'F408', 'F409', 'F410', 'F411', 'F413', 'F418', 'F419', 'F42', 'F422', 'F423', 'F424', 'F428', 'F429', 'F430', 'F4310', 'F4311', 'F4312', 'F449', 'F458', 'F488', 'F489', 'F938', 'F99', 'R452', 'R455', 'R456', 'R457'); MPRINT(MEDPAR_ANALYSIS): array bipolar_codes[42] $8 _temporary_ ( 'F3010', 'F3011', 'F3012', 'F3013', 'F302', 'F303', 'F304', 'F308', 'F309', 'F310', 'F3110', 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 'F3161', 'F3162', 'F3163', 'F3164', 'F3170', 'F3171', 'F3172', 'F3173', 'F3174', 'F3175', 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 'F319', 'F338', 'F3481', 'F3489', 'F349', 'F39'); MPRINT(MEDPAR_ANALYSIS): array TBI_codes [262] $8 _temporary_( 'F070', 'F0781', 'F0789', 'F482', 'S04011S', 'S04012S', 'S04019S', 'S0402XS', 'S04031S', 'S04032S', 'S04039S', 'S04041S', 'S04042S', 'S04049S', 'S0410XS', 'S0411XS', 'S0412XS', 'S0420XS', 'S0421XS', 'S0422XS', 'S0430XS', 'S0431XS', 'S0432XS', 'S0440XS', 'S0441XS', 'S0442XS', 'S0450XS', 'S0451XS', 'S0452XS', 'S0460XS', 'S0461XS', 'S0462XS', 'S0470XS', 'S0471XS', 'S0472XS', 'S04811S', 'S04812S', 'S04819S', 'S04891S', 'S04892S', 'S04899S', 'S049XXS', 'S060X0S', 'S060X1S', 'S060X2S', 'S060X3S', 'S060X4S', 'S060X5S', 'S060X6S', 'S060X7S', 'S060X8S', 'S060XAS', 'S060X9S', 'S061X0S', 'S061X1S', 'S061X2S', 'S061X3S', 'S061X4S', 'S061X5S', 'S061X6S', 'S061X7S', 'S061X8S', 'S061XAS', 'S061X9S', 'S062X0S', 'S062X1S', 'S062X2S', 'S062X3S', 'S062X4S', 'S062X5S', 'S062X6S', 'S062X7S', 'S062X8S', 'S062XAS', 'S062X9S', 'S06300S', 'S06301S', 'S06302S', 'S06303S', 'S06304S', 'S06305S', 'S06306S', 'S06307S', 'S06308S', 'S0630AS', 'S06309S', 'S06310S', 'S06311S', 'S06312S', 'S06313S', 'S06314S', 'S06315S', 'S06316S', 'S06317S', 'S06318S', 'S0631AS', 'S06319S', 'S06320S', 'S06321S', 'S06322S', 'S06323S', 'S06324S', 'S06325S', 'S06326S', 'S06327S', 'S06328S', 'S0632AS', 'S06329S', 'S06330S', 'S06331S', 'S06332S', 'S06333S', 'S06334S', 'S06335S', 'S06336S', 'S06337S', 'S06338S', 'S0633AS', 'S06339S', 'S06340S', 'S06341S', 'S06342S', 'S06343S', 'S06344S', 'S06345S', 'S06346S', 'S06347S', 'S06348S', 'S0634AS', 'S06349S', 'S06350S', 'S06351S', 'S06352S', 'S06353S', 'S06354S', 'S06355S', 'S06356S', 'S06357S', 'S06358S', 'S0635AS', 'S06359S', 'S06360S', 'S06361S', 'S06362S', 'S06363S', 'S06364S', 'S06365S', 'S06366S', 'S06367S', 'S06368S', 'S0636AS', 'S06369S', 'S06370S', 'S06371S', 'S06372S', 'S06373S', 'S06374S', 'S06375S', 'S06376S', 'S06377S', 'S06378S', 'S0637AS', 'S06379S', 'S06380S', 'S06381S', 'S06382S', 'S06383S', 'S06384S', 'S06385S', 'S06386S', 'S06387S', 'S06388S', 'S0638AS', 'S06389S', 'S064X0S', 'S064X1S', 'S064X2S', 'S064X3S', 'S064X4S', 'S064X5S', 'S064X6S', 'S064X7S', 'S064X8S', 'S064XAS', 'S064X9S', 'S065X0S', 'S065X1S', 'S065X2S', 'S065X3S', 'S065X4S', 'S065X5S', 'S065X6S', 'S065X7S', 'S065X8S', 'S065XAS', 'S065X9S', 'S066X0S', 'S066X1S', 'S066X2S', 'S066X3S', 'S066X4S', 'S066X5S', 'S066X6S', 'S066X7S', 'S066X8S', 'S066XAS', 'S066X9S', 'S06810S', 'S06811S', 'S06812S', 'S06813S', 'S06814S', 'S06815S', 'S06816S', 'S06817S', 'S06818S', 'S0681AS', 'S06819S', 'S06820S', 'S06821S', 'S06822S', 'S06823S', 'S06824S', 'S06825S', 'S06826S', 'S06827S', 'S06828S', 'S0682AS', 'S06829S', 'S068A0S', 'S068A1S', 'S068A2S', 'S068A3S', 'S068A4S', 'S068A5S', 'S068A6S', 'S068AAS', 'S068A9S', 'S06890S', 'S06891S', 'S06892S', 'S06893S', 'S06894S', 'S06895S', 'S06896S', 'S06897S', 'S06898S', 'S0689AS', 'S06899S', 'S069X0S', 'S069X1S', 'S069X2S', 'S069X3S', 'S069X4S', 'S069X5S', 'S069X6S', 'S069X7S', 'S069X8S', 'S069XAS', 'S069X9S', 'S06A0XS', 'S06A1XS'); MPRINT(MEDPAR_ANALYSIS): array DRUG_USE_CODES[133] $8 _temporary_ ('HZ2ZZZZ', 'HZ30ZZZ', 'HZ31ZZZ', 'HZ32ZZZ', 'HZ33ZZZ', 'HZ34ZZZ', 'HZ35ZZZ', 'HZ36ZZZ', 'HZ37ZZZ', 'HZ38ZZZ', 'HZ39ZZZ', 'HZ3BZZZ', 'HZ40ZZZ', 'HZ93ZZZ', 'HZ96ZZZ' 'F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 'F1123', 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 'F11920', 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 'F11982', 'F11988', 'F1199', 'F1210', 'F12120', 'F12121', 'F12122', 'F12129', 'F1213', 'F12150', 'F12151', 'F12159', 'F12180', 'F12188', 'F1219', 'F1220', 'F12220', 'F12221', 'F12222', 'F12229', 'F12250', 'F1629', 'F1690', 'F16920', 'F16921', 'F16929', 'F1694', 'F16950', 'F16951', 'F16959', 'F16980', 'F16983', 'F16988', 'F1699', 'F17203', 'F17208', 'F17209', 'F17213', 'F17218', 'F17219', 'F17223', 'F17228', 'F17229', 'F17293', 'F17298', 'F17299', 'F1810', 'F18120', 'F18121', 'F18129', 'F1814', 'F18150', 'F18151', 'F18159', 'F1817', 'F18180', 'F18188', 'F1819', 'F1820', 'F18220', 'F18221', 'F18229', 'F1824', 'F18250', 'F18251', 'F18259', 'F1827', 'F18280', 'F18288', 'F1829', 'F1890', 'F18920', 'F18921', 'F18929', 'F1894', 'F18950', 'F18951', 'F18959', 'F1897'); MPRINT(MEDPAR_ANALYSIS): array PSYCH_CODES[12] $8 _temporary_ ('F200', 'F201', 'F202', 'F203', 'F205', 'F2081', 'F2089', 'F209', 'F250', 'F251', 'F258', 'F259'); MPRINT(MEDPAR_ANALYSIS): array OUD_codes[197] $8 _temporary_ ('F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 'F1123', 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 'F11920', 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 'F11982', 'F11988', 'F1199', 'HZ81ZZZ', 'HZ84ZZZ', 'HZ85ZZZ', 'HZ86ZZZ', 'HZ91ZZZ', 'HZ94ZZZ', 'HZ95ZZZ', 'HZ96ZZZ', 'T400X1A', 'T400X1D', 'T400X1S', 'T400X2A', 'T400X2D', 'T400X2S', 'T400X3A', 'T400X3D', 'T400X3S', 'T400X4A', 'T400X4D', 'T400X4S', 'T400X5A', 'T400X5D', 'T400X5S', 'T401X1A', 'T401X1D', 'T401X1S', 'T401X2A', 'T401X2D', 'T401X2S', 'T401X3A', 'T401X3D', 'T401X3S', 'T401X4A', 'T401X4D', 'T401X4S', 'T402X1A', 'T402X1D', 'T402X1S', 'T402X2A', 'T402X2D', 'T402X2S', 'T402X3A', 'T402X3D', 'T402X3S', 'T402X4A', 'T402X4D', 'T402X4S', 'T402X5A', 'T402X5D', 'T402X5S', 'T403X1A', 'T403X1D', 'T403X1S', 'T403X2A', 'T403X2D', 'T403X2S', 'T403X3A', 'T403X3D', 'T403X3S', 'T403X4A', 'T403X4D', 'T403X4S', 'T403X5A', 'T403X5D', 'T403X5S', 'T40411A', 'T40411D', 'T40411S', 'T40412A', 'T40412D', 'T40412S', 'T40413A', 'T40413D', 'T40413S', 'T40414A', 'T40414D', 'T40414S', 'T40415A', 'T40415D', 'T40415S', 'T40421A', 'T40421D', 'T40421S', 'T40422A', 'T40422D', 'T40422S', 'T40423A', 'T40423D', 'T40423S', 'T40424A', 'T40424D', 'T40424S', 'T40425A', 'T40425D', 'T40425S', 'T40491A', 'T40491D', 'T40491S', 'T40492A', 'T40492D', 'T40492S', 'T40493A', 'T40493D', 'T40493S', 'T40494A', 'T40494D', 'T40494S', 'T40495A', 'T40495D', 'T40495S', 'T404X1A', 'T404X1D', 'T404X1S', 'T404X2A', 'T404X2D', 'T404X2S', 'T404X3A', 'T404X3D', 'T404X3S', 'T404X4A', 'T404X4D', 'T404X4S', 'T404X5A', 'T404X5D', 'T404X5S', 'T40601A', 'T40601D', 'T40601S', 'T40602A', 'T40602D', 'T40602S', 'T40603A', 'T40603D', 'T40603S', 'T40604A', 'T40604D', 'T40604S', 'T40605A', 'T40605D', 'T40605S', 'T40691A', 'T40691D', 'T40691S', 'T40692A', 'T40692D', 'T40692S', 'T40693A', 'T40693D', 'T40693S', 'T40694A', 'T40694D', 'T40694S', 'T40695A', 'T40695D', 'T40695S'); MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if not missing(DGNS[i])then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then DEPRESSION_MEDPAR=1; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(DEPRESSION_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then DEPRESSION_MEDPAR =0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in alzhimers_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then DEPRESSION_MEDPAR= 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): *assigning -9 to missing DGNS values; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(DEPRESSION_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then DEPRESSION_MEDPAR =-9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): * end; MPRINT(MEDPAR_ANALYSIS): indicator1 = 0; MPRINT(MEDPAR_ANALYSIS): indicator2 = 0; MPRINT(MEDPAR_ANALYSIS): indicator3 = 0; MPRINT(MEDPAR_ANALYSIS): indicator4 = 0; MPRINT(MEDPAR_ANALYSIS): indicator5 = 0; MPRINT(MEDPAR_ANALYSIS): indicator6 = 0; MPRINT(MEDPAR_ANALYSIS): indicator7 = 0; MPRINT(MEDPAR_ANALYSIS): indicator8 = 0; MPRINT(MEDPAR_ANALYSIS): indicator9 = 0; MPRINT(MEDPAR_ANALYSIS): indicator10 = 0; MPRINT(MEDPAR_ANALYSIS): indicator11 = 0; MPRINT(MEDPAR_ANALYSIS): indicator12 = 0; MPRINT(MEDPAR_ANALYSIS): indicator13 = 0; MPRINT(MEDPAR_ANALYSIS): indicator14 = 0; MPRINT(MEDPAR_ANALYSIS): indicator15 = 0; MPRINT(MEDPAR_ANALYSIS): indicator16 = 0; MPRINT(MEDPAR_ANALYSIS): indicator17 = 0; MPRINT(MEDPAR_ANALYSIS): indicator18 = 0; MPRINT(MEDPAR_ANALYSIS): indicator19 = 0; MPRINT(MEDPAR_ANALYSIS): indicator20 = 0; MPRINT(MEDPAR_ANALYSIS): indicator21 = 0; MPRINT(MEDPAR_ANALYSIS): indicator22 = 0; MPRINT(MEDPAR_ANALYSIS): indicator23 = 0; MPRINT(MEDPAR_ANALYSIS): indicator24 = 0; MPRINT(MEDPAR_ANALYSIS): indicator25 = 0; MPRINT(MEDPAR_ANALYSIS): indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in depression_codes then indicator1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in depression_codes then indicator2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in depression_codes then indicator3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in depression_codes then indicator4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in depression_codes then indicator5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in depression_codes then indicator6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in depression_codes then indicator7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in depression_codes then indicator8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in depression_codes then indicator9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in depression_codes then indicator10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in depression_codes then indicator11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in depression_codes then indicator12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in depression_codes then indicator13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in depression_codes then indicator14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in depression_codes then indicator15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in depression_codes then indicator16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in depression_codes then indicator17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in depression_codes then indicator18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in depression_codes then indicator19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in depression_codes then indicator20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in depression_codes then indicator21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in depression_codes then indicator22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in depression_codes then indicator23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in depression_codes then indicator24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in depression_codes then indicator25 = 1; MPRINT(MEDPAR_ANALYSIS): indicator_count=sum(of indicator1-indicator25); MPRINT(MEDPAR_ANALYSIS): if indicator_count > 0 then indicator_all = 1; MPRINT(MEDPAR_ANALYSIS): *this part of the code will assign a 1 to any depression codes; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if not missing(DGNS[i])then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then NONALZH_DEMEN_MEDPAR=1; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(NONALZH_DEMEN_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in alzhimers_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): *assigning -9 to missing DGNS values; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(NONALZH_DEMEN_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then NONALZH_DEMEN_MEDPAR =-9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_1 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_2 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_3 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_4 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_5 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_6 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_7 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_8 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_9 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_10 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_11 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_12 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_13 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_14 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_15 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_16 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_17 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_18 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_19 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_20 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_21 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_22 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_23 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_24 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_25 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in nonalzhimers_codes then nonalzhimers_indicator_1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in nonalzhimers_codes then nonalzhimers_indicator_2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in nonalzhimers_codes then nonalzhimers_indicator_3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in nonalzhimers_codes then nonalzhimers_indicator_4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in nonalzhimers_codes then nonalzhimers_indicator_5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in nonalzhimers_codes then nonalzhimers_indicator_6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in nonalzhimers_codes then nonalzhimers_indicator_7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in nonalzhimers_codes then nonalzhimers_indicator_8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in nonalzhimers_codes then nonalzhimers_indicator_9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in nonalzhimers_codes then nonalzhimers_indicator_10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in nonalzhimers_codes then nonalzhimers_indicator_11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in nonalzhimers_codes then nonalzhimers_indicator_12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in nonalzhimers_codes then nonalzhimers_indicator_13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in nonalzhimers_codes then nonalzhimers_indicator_14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in nonalzhimers_codes then nonalzhimers_indicator_15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in nonalzhimers_codes then nonalzhimers_indicator_16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in nonalzhimers_codes then nonalzhimers_indicator_17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in nonalzhimers_codes then nonalzhimers_indicator_18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in nonalzhimers_codes then nonalzhimers_indicator_19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in nonalzhimers_codes then nonalzhimers_indicator_20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in nonalzhimers_codes then nonalzhimers_indicator_21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in nonalzhimers_codes then nonalzhimers_indicator_22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in nonalzhimers_codes then nonalzhimers_indicator_23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in nonalzhimers_codes then nonalzhimers_indicator_24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in nonalzhimers_codes then nonalzhimers_indicator_25 = 1; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_count = sum(of nonalzhimers_indicator_1-nonalzhimers_indicator_25); MPRINT(MEDPAR_ANALYSIS): if nonalzhimers_indicator_count > 0 then nonalzhimers_indicator_all = 1; MPRINT(MEDPAR_ANALYSIS): **************************************************************************************************** do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(ALZH_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0; NOTE: Line generated by the invoked macro "MEDPAR_ANALYSIS". 269 then ALZH_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 269 ! if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; end; end; do i = 1 to dim(DGNS) --- 161 269 ! ; if missing(ALZH_MEDPAR) then do; if missing(DGNS[i]) MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(ALZH_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then ALZH_MEDPAR = -9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_1 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_2 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_3 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_4 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_5 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_6 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_7 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_8 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_9 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_10 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_11 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_12 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_13 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_14 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_15 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_16 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_17 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_18 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_19 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_20 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_21 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_22 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_23 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_24 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_25 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in alzhimers_codes then alzh_indicator_1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in alzhimers_codes then alzh_indicator_2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in alzhimers_codes then alzh_indicator_3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in alzhimers_codes then alzh_indicator_4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in alzhimers_codes then alzh_indicator_5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in alzhimers_codes then alzh_indicator_6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in alzhimers_codes then alzh_indicator_7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in alzhimers_codes then alzh_indicator_8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in alzhimers_codes then alzh_indicator_9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in alzhimers_codes then alzh_indicator_10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in alzhimers_codes then alzh_indicator_11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in alzhimers_codes then alzh_indicator_12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in alzhimers_codes then alzh_indicator_13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in alzhimers_codes then alzh_indicator_14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in alzhimers_codes then alzh_indicator_15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in alzhimers_codes then alzh_indicator_16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in alzhimers_codes then alzh_indicator_17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in alzhimers_codes then alzh_indicator_18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in alzhimers_codes then alzh_indicator_19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in alzhimers_codes then alzh_indicator_20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in alzhimers_codes then alzh_indicator_21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in alzhimers_codes then alzh_indicator_22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in alzhimers_codes then alzh_indicator_23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in alzhimers_codes then alzh_indicator_24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in alzhimers_codes then alzh_indicator_25 = 1; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_count = sum(of alzh_indicator_1-alzh_indicator_25); MPRINT(MEDPAR_ANALYSIS): if alzh_indicator_count > 0 then alzh_indicator_all = 1; ERROR 161-185: No matching DO/SELECT statement. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2020_1 may be incomplete. When this step was stopped there were 0 observations and 763 variables. WARNING: Data set OUTPUT.MERGED_MEDPAR_MBSF_PDPN_2020_1 was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.10 seconds cpu time 0.07 seconds MPRINT(MEDPAR_ANALYSIS): data output.merged_medpar_mbsf_pdpn_2021_1; MPRINT(MEDPAR_ANALYSIS): set output.merged_medpar_mbsf_pdpn_2021_1; MPRINT(MEDPAR_ANALYSIS): array DGNS[25] $ DGNS_1_CD -- DGNS_25_CD; MPRINT(MEDPAR_ANALYSIS): DEPRESSION_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): NONALZH_DEMEN_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): ALZH_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): PNEUMO_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): hf_medpar =.; MPRINT(MEDPAR_ANALYSIS): PRKNSN_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): STROKE_TIA_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): ANXI_MEDICARE_MEDPAR =.; MPRINT(MEDPAR_ANALYSIS): BIPOLAR_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): TBI_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): DRUGS_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): SCHIOT_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): OUD_ANY_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): array depression_codes[50] $8 _temporary_ ('F0631', 'F0632', 'F310', 'F3110', 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 'F3161', 'F3162', 'F3163', 'F3164', 'F3171', 'F3173', 'F3175', 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 'F319', 'F320', 'F321', 'F322', 'F323', 'F324', 'F325', 'F328', 'F3289', 'F329', 'F32A', 'F330', 'F331', 'F332', 'F333', 'F3340', 'F3341', 'F3342', 'F338', 'F339', 'F340', 'F341', 'F4321', 'F4323'); MPRINT(MEDPAR_ANALYSIS): array nonalzhimers_codes[84] $8 _temporary_ ('F0150', 'F0151', 'F01511', 'F01518', 'F0152', 'F0153', 'F0154', 'F01A0', 'F01A11', 'F01A18', 'F01A2', 'F01A3', 'F01A4', 'F01B0', 'F01B11', 'F01B18', 'F01B2', 'F01B3', 'F01B4', 'F01C0', 'F01C11', 'F01C18', 'F01C2', 'F01C3', 'F01C4', 'F0280', 'F0281', 'F02811', 'F02818', 'F0282', 'F0283', 'F0284', 'F02A0', 'F02A11', 'F02A18', 'F02A2', 'F02A3', 'F02A4', 'F02B0', 'F02B11', 'F02B18', 'F02B2', 'F02B3', 'F02B4', 'F02C0', 'F02C11', 'F02C18', 'F02C2', 'F02C3', 'F02C4', 'F0390', 'F0391', 'F03911', 'F03918', 'F0392', 'F0393', 'F0394', 'F03A0', 'F03A11', 'F03A18', 'F03A2', 'F03A3', 'F03A4', 'F03B0', 'F03B11', 'F03B18', 'F03B2', 'F03B3', 'F03B4', 'F03C0', 'F03C11', 'F03C18', 'F03C2', 'F03C3', 'F03C4', 'F05', 'G138', 'G3101', 'G3109', 'G311', 'G312', 'G3183', 'G94', 'R4181'); MPRINT(MEDPAR_ANALYSIS): array alzhimers_codes[4] $8 _temporary_ ('G300', 'G301','G308', 'G309'); MPRINT(MEDPAR_ANALYSIS): array pneumonia_codes[93] $8 _temporary_( 'A0103', 'A0222', 'A065', 'A202', 'A212', 'A221', 'A310', 'A3701', 'A3711', 'A3781', 'A3791', 'A403', 'A420', 'A430', 'A481', 'A5004', 'A5484', 'B012', 'B052', 'B0681', 'B371', 'B380', 'B382', 'B390', 'B392', 'B400', 'B402', 'B410', 'B583', 'B59', 'B664', 'B671', 'B7781', 'B953', 'B960', 'B961', 'J09X1', 'J1000', 'J1001', 'J1008', 'J1100', 'J1108', 'J120', 'J121', 'J122', 'J123', 'J1281', 'J1282', 'J1289', 'J129', 'J13', 'J14', 'J150', 'J151', 'J1520', 'J15211', 'J15212', 'J1529', 'J153', 'J154', 'J155', 'J156', 'J1561', 'J1569', 'J157', 'J158', 'J159', 'J160', 'J168', 'J17', 'J180', 'J181', 'J182', 'J188', 'J189', 'J200', 'J84111', 'J84116', 'J84117', 'J84178', 'J842', 'J851', 'J95851', 'P230', 'P231', 'P232', 'P233', 'P234', 'P235', 'P236', 'P238', 'P239', 'Z8701'); MPRINT(MEDPAR_ANALYSIS): array hf_codes[34] $8 _temporary_ ( 'I0981', 'I110', 'I130', 'I132', 'I420', 'I425', 'I426', 'I427', 'I428', 'I43', 'I501', 'I5020', 'I5021', 'I5022', 'I5023', 'I5030', 'I5031', 'I5032', 'I5033', 'I5040', 'I5041', 'I5042', 'I5043', 'I50810', 'I50811', 'I50812', 'I50813', 'I50814', 'I5082', 'I5083', 'I5084', 'I5089', 'I509', 'P290'); MPRINT(MEDPAR_ANALYSIS): array prknsn_codes[13] $8 _temporary_ ( 'G20', 'G20A1', 'G20A2', 'G20B1', 'G20B2', 'G20C', 'G2111', 'G2119', 'G213', 'G214', 'G218', 'G219', 'G3183'); MPRINT(MEDPAR_ANALYSIS): array stroke_codes[150] $8 _temporary_ ( 'G450', 'G451', 'G452', 'G453', 'G458', 'G459', 'G460', 'G461', 'G462', 'G463', 'G464', 'G465', 'G466', 'G467', 'G468', 'G9731', 'G9732', 'I6000', 'I6001', 'I6002', 'I6010', 'I6011', 'I6012', 'I602', 'I6020', 'I6021', 'I6022', 'I6030', 'I6031', 'I6032', 'I604', 'I6050', 'I6051', 'I6052', 'I606', 'I607', 'I608', 'I609', 'I610', 'I611', 'I612', 'I613', 'I614', 'I615', 'I616', 'I618', 'I619', 'I6200', 'I6201', 'I6202', 'I629', 'I6300', 'I63011', 'I63012', 'I63013', 'I63019', 'I6302', 'I63031', 'I63032', 'I63033', 'I63039', 'I6309', 'I6310', 'I63111', 'I63112', 'I63113', 'I63119', 'I6312', 'I63131', 'I63132', 'I63133', 'I63139', 'I6319', 'I6320', 'I63211', 'I63212', 'I63213', 'I63219', 'I6322', 'I63231', 'I63232', 'I63233', 'I63239', 'I6329', 'I6330', 'I63311', 'I63312', 'I63313', 'I63319', 'I63321', 'I63322', 'I63323', 'I63329', 'I63331', 'I63332', 'I63333', 'I63339', 'I63341', 'I63342', 'I63343', 'I63349', 'I6339', 'I6340', 'I63411', 'I63412', 'I63413', 'I63419', 'I63421', 'I63422', 'I63423', 'I63429', 'I63431', 'I63432', 'I63433', 'I63439', 'I63441', 'I63442', 'I63443', 'I63449', 'I6349', 'I6350', 'I63511', 'I63512', 'I63513', 'I63519', 'I63521', 'I63522', 'I63523', 'I63529', 'I63531', 'I63532', 'I63533', 'I63539', 'I63541', 'I63542', 'I63543', 'I63549', 'I6359', 'I636', 'I638', 'I6381', 'I6389', 'I639', 'I67841', 'I67848', 'I6789', 'I97810', 'I97811', 'I97820', 'I97821'); MPRINT(MEDPAR_ANALYSIS): array stroke_exclusion_codes[119] $8 _temporary_ ( 'S06340A', 'S06341A', 'S06342A', 'S06343A', 'S06344A', 'S06345A', 'S06346A', 'S06347A', 'S06348A', 'S0634AA', 'S06349A', 'S06350A', 'S06351A', 'S06352A', 'S06353A', 'S06354A', 'S06355A', 'S06356A', 'S06357A', 'S06358A', 'S0635AA', 'S06359A', 'S06360A', 'S06361A', 'S06362A', 'S06363A', 'S06364A', 'S06365A', 'S06366A', 'S06367A', 'S06368A', 'S0636AA', 'S06369A', 'S06370A', 'S06371A', 'S06372A', 'S06373A', 'S06374A', 'S06375A', 'S06376A', 'S06377A', 'S06378A', 'S0637AA', 'S06379A', 'S06380A', 'S06381A', 'S06382A', 'S06383A', 'S06384A', 'S06385A', 'S06386A', 'S06387A', 'S06388A', 'S0638AA', 'S06389A', 'S065X0A', 'S065X1A', 'S065X2A', 'S065X3A', 'S065X4A', 'S065X5A', 'S065X6A', 'S065X7A', 'S065X8A', 'S065XAA', 'S065X9A', 'S066X0A', 'S066X1A', 'S066X2A', 'S066X3A', 'S066X4A', 'S066X5A', 'S066X6A', 'S066X7A', 'S066X8A', 'S066XAA', 'S066X9A', 'S06810A', 'S06811A', 'S06812A', 'S06813A', 'S06814A', 'S06815A', 'S06816A', 'S06817A', 'S06818A', 'S0681AA', 'S06819A', 'S06820A', 'S06821A', 'S06822A', 'S06823A', 'S06824A', 'S06825A', 'S06826A', 'S06827A', 'S06828A', 'S0682AA', 'S06829A', 'S06890A', 'S06891A', 'S06892A', 'S06893A', 'S06894A', 'S06895A', 'S06896A', 'S06897A', 'S06898A', 'S0689AA', 'S06899A', 'S069X0A', 'S069X1A', 'S069X2A', 'S069X3A', 'S069X4A', 'S069X5A', 'S069X6A', 'S069X7A', 'S069X8A'); MPRINT(MEDPAR_ANALYSIS): array anxiety_codes[49] $8 _temporary_ ( 'F064', 'F4000', 'F4001', 'F4002', 'F4010', 'F4011', 'F40210', 'F40218', 'F40220', 'F40228', 'F40230', 'F40231', 'F40232', 'F40233', 'F40240', 'F40241', 'F40242', 'F40243', 'F40248', 'F40290', 'F40291', 'F40298', 'F408', 'F409', 'F410', 'F411', 'F413', 'F418', 'F419', 'F42', 'F422', 'F423', 'F424', 'F428', 'F429', 'F430', 'F4310', 'F4311', 'F4312', 'F449', 'F458', 'F488', 'F489', 'F938', 'F99', 'R452', 'R455', 'R456', 'R457'); MPRINT(MEDPAR_ANALYSIS): array bipolar_codes[42] $8 _temporary_ ( 'F3010', 'F3011', 'F3012', 'F3013', 'F302', 'F303', 'F304', 'F308', 'F309', 'F310', 'F3110', 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 'F3161', 'F3162', 'F3163', 'F3164', 'F3170', 'F3171', 'F3172', 'F3173', 'F3174', 'F3175', 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 'F319', 'F338', 'F3481', 'F3489', 'F349', 'F39'); MPRINT(MEDPAR_ANALYSIS): array TBI_codes [262] $8 _temporary_( 'F070', 'F0781', 'F0789', 'F482', 'S04011S', 'S04012S', 'S04019S', 'S0402XS', 'S04031S', 'S04032S', 'S04039S', 'S04041S', 'S04042S', 'S04049S', 'S0410XS', 'S0411XS', 'S0412XS', 'S0420XS', 'S0421XS', 'S0422XS', 'S0430XS', 'S0431XS', 'S0432XS', 'S0440XS', 'S0441XS', 'S0442XS', 'S0450XS', 'S0451XS', 'S0452XS', 'S0460XS', 'S0461XS', 'S0462XS', 'S0470XS', 'S0471XS', 'S0472XS', 'S04811S', 'S04812S', 'S04819S', 'S04891S', 'S04892S', 'S04899S', 'S049XXS', 'S060X0S', 'S060X1S', 'S060X2S', 'S060X3S', 'S060X4S', 'S060X5S', 'S060X6S', 'S060X7S', 'S060X8S', 'S060XAS', 'S060X9S', 'S061X0S', 'S061X1S', 'S061X2S', 'S061X3S', 'S061X4S', 'S061X5S', 'S061X6S', 'S061X7S', 'S061X8S', 'S061XAS', 'S061X9S', 'S062X0S', 'S062X1S', 'S062X2S', 'S062X3S', 'S062X4S', 'S062X5S', 'S062X6S', 'S062X7S', 'S062X8S', 'S062XAS', 'S062X9S', 'S06300S', 'S06301S', 'S06302S', 'S06303S', 'S06304S', 'S06305S', 'S06306S', 'S06307S', 'S06308S', 'S0630AS', 'S06309S', 'S06310S', 'S06311S', 'S06312S', 'S06313S', 'S06314S', 'S06315S', 'S06316S', 'S06317S', 'S06318S', 'S0631AS', 'S06319S', 'S06320S', 'S06321S', 'S06322S', 'S06323S', 'S06324S', 'S06325S', 'S06326S', 'S06327S', 'S06328S', 'S0632AS', 'S06329S', 'S06330S', 'S06331S', 'S06332S', 'S06333S', 'S06334S', 'S06335S', 'S06336S', 'S06337S', 'S06338S', 'S0633AS', 'S06339S', 'S06340S', 'S06341S', 'S06342S', 'S06343S', 'S06344S', 'S06345S', 'S06346S', 'S06347S', 'S06348S', 'S0634AS', 'S06349S', 'S06350S', 'S06351S', 'S06352S', 'S06353S', 'S06354S', 'S06355S', 'S06356S', 'S06357S', 'S06358S', 'S0635AS', 'S06359S', 'S06360S', 'S06361S', 'S06362S', 'S06363S', 'S06364S', 'S06365S', 'S06366S', 'S06367S', 'S06368S', 'S0636AS', 'S06369S', 'S06370S', 'S06371S', 'S06372S', 'S06373S', 'S06374S', 'S06375S', 'S06376S', 'S06377S', 'S06378S', 'S0637AS', 'S06379S', 'S06380S', 'S06381S', 'S06382S', 'S06383S', 'S06384S', 'S06385S', 'S06386S', 'S06387S', 'S06388S', 'S0638AS', 'S06389S', 'S064X0S', 'S064X1S', 'S064X2S', 'S064X3S', 'S064X4S', 'S064X5S', 'S064X6S', 'S064X7S', 'S064X8S', 'S064XAS', 'S064X9S', 'S065X0S', 'S065X1S', 'S065X2S', 'S065X3S', 'S065X4S', 'S065X5S', 'S065X6S', 'S065X7S', 'S065X8S', 'S065XAS', 'S065X9S', 'S066X0S', 'S066X1S', 'S066X2S', 'S066X3S', 'S066X4S', 'S066X5S', 'S066X6S', 'S066X7S', 'S066X8S', 'S066XAS', 'S066X9S', 'S06810S', 'S06811S', 'S06812S', 'S06813S', 'S06814S', 'S06815S', 'S06816S', 'S06817S', 'S06818S', 'S0681AS', 'S06819S', 'S06820S', 'S06821S', 'S06822S', 'S06823S', 'S06824S', 'S06825S', 'S06826S', 'S06827S', 'S06828S', 'S0682AS', 'S06829S', 'S068A0S', 'S068A1S', 'S068A2S', 'S068A3S', 'S068A4S', 'S068A5S', 'S068A6S', 'S068AAS', 'S068A9S', 'S06890S', 'S06891S', 'S06892S', 'S06893S', 'S06894S', 'S06895S', 'S06896S', 'S06897S', 'S06898S', 'S0689AS', 'S06899S', 'S069X0S', 'S069X1S', 'S069X2S', 'S069X3S', 'S069X4S', 'S069X5S', 'S069X6S', 'S069X7S', 'S069X8S', 'S069XAS', 'S069X9S', 'S06A0XS', 'S06A1XS'); MPRINT(MEDPAR_ANALYSIS): array DRUG_USE_CODES[133] $8 _temporary_ ('HZ2ZZZZ', 'HZ30ZZZ', 'HZ31ZZZ', 'HZ32ZZZ', 'HZ33ZZZ', 'HZ34ZZZ', 'HZ35ZZZ', 'HZ36ZZZ', 'HZ37ZZZ', 'HZ38ZZZ', 'HZ39ZZZ', 'HZ3BZZZ', 'HZ40ZZZ', 'HZ93ZZZ', 'HZ96ZZZ' 'F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 'F1123', 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 'F11920', 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 'F11982', 'F11988', 'F1199', 'F1210', 'F12120', 'F12121', 'F12122', 'F12129', 'F1213', 'F12150', 'F12151', 'F12159', 'F12180', 'F12188', 'F1219', 'F1220', 'F12220', 'F12221', 'F12222', 'F12229', 'F12250', 'F1629', 'F1690', 'F16920', 'F16921', 'F16929', 'F1694', 'F16950', 'F16951', 'F16959', 'F16980', 'F16983', 'F16988', 'F1699', 'F17203', 'F17208', 'F17209', 'F17213', 'F17218', 'F17219', 'F17223', 'F17228', 'F17229', 'F17293', 'F17298', 'F17299', 'F1810', 'F18120', 'F18121', 'F18129', 'F1814', 'F18150', 'F18151', 'F18159', 'F1817', 'F18180', 'F18188', 'F1819', 'F1820', 'F18220', 'F18221', 'F18229', 'F1824', 'F18250', 'F18251', 'F18259', 'F1827', 'F18280', 'F18288', 'F1829', 'F1890', 'F18920', 'F18921', 'F18929', 'F1894', 'F18950', 'F18951', 'F18959', 'F1897'); MPRINT(MEDPAR_ANALYSIS): array PSYCH_CODES[12] $8 _temporary_ ('F200', 'F201', 'F202', 'F203', 'F205', 'F2081', 'F2089', 'F209', 'F250', 'F251', 'F258', 'F259'); MPRINT(MEDPAR_ANALYSIS): array OUD_codes[197] $8 _temporary_ ('F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 'F1123', 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 'F11920', 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 'F11982', 'F11988', 'F1199', 'HZ81ZZZ', 'HZ84ZZZ', 'HZ85ZZZ', 'HZ86ZZZ', 'HZ91ZZZ', 'HZ94ZZZ', 'HZ95ZZZ', 'HZ96ZZZ', 'T400X1A', 'T400X1D', 'T400X1S', 'T400X2A', 'T400X2D', 'T400X2S', 'T400X3A', 'T400X3D', 'T400X3S', 'T400X4A', 'T400X4D', 'T400X4S', 'T400X5A', 'T400X5D', 'T400X5S', 'T401X1A', 'T401X1D', 'T401X1S', 'T401X2A', 'T401X2D', 'T401X2S', 'T401X3A', 'T401X3D', 'T401X3S', 'T401X4A', 'T401X4D', 'T401X4S', 'T402X1A', 'T402X1D', 'T402X1S', 'T402X2A', 'T402X2D', 'T402X2S', 'T402X3A', 'T402X3D', 'T402X3S', 'T402X4A', 'T402X4D', 'T402X4S', 'T402X5A', 'T402X5D', 'T402X5S', 'T403X1A', 'T403X1D', 'T403X1S', 'T403X2A', 'T403X2D', 'T403X2S', 'T403X3A', 'T403X3D', 'T403X3S', 'T403X4A', 'T403X4D', 'T403X4S', 'T403X5A', 'T403X5D', 'T403X5S', 'T40411A', 'T40411D', 'T40411S', 'T40412A', 'T40412D', 'T40412S', 'T40413A', 'T40413D', 'T40413S', 'T40414A', 'T40414D', 'T40414S', 'T40415A', 'T40415D', 'T40415S', 'T40421A', 'T40421D', 'T40421S', 'T40422A', 'T40422D', 'T40422S', 'T40423A', 'T40423D', 'T40423S', 'T40424A', 'T40424D', 'T40424S', 'T40425A', 'T40425D', 'T40425S', 'T40491A', 'T40491D', 'T40491S', 'T40492A', 'T40492D', 'T40492S', 'T40493A', 'T40493D', 'T40493S', 'T40494A', 'T40494D', 'T40494S', 'T40495A', 'T40495D', 'T40495S', 'T404X1A', 'T404X1D', 'T404X1S', 'T404X2A', 'T404X2D', 'T404X2S', 'T404X3A', 'T404X3D', 'T404X3S', 'T404X4A', 'T404X4D', 'T404X4S', 'T404X5A', 'T404X5D', 'T404X5S', 'T40601A', 'T40601D', 'T40601S', 'T40602A', 'T40602D', 'T40602S', 'T40603A', 'T40603D', 'T40603S', 'T40604A', 'T40604D', 'T40604S', 'T40605A', 'T40605D', 'T40605S', 'T40691A', 'T40691D', 'T40691S', 'T40692A', 'T40692D', 'T40692S', 'T40693A', 'T40693D', 'T40693S', 'T40694A', 'T40694D', 'T40694S', 'T40695A', 'T40695D', 'T40695S'); MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if not missing(DGNS[i])then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then DEPRESSION_MEDPAR=1; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(DEPRESSION_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then DEPRESSION_MEDPAR =0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in alzhimers_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then DEPRESSION_MEDPAR= 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then DEPRESSION_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): *assigning -9 to missing DGNS values; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(DEPRESSION_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then DEPRESSION_MEDPAR =-9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): * end; MPRINT(MEDPAR_ANALYSIS): indicator1 = 0; MPRINT(MEDPAR_ANALYSIS): indicator2 = 0; MPRINT(MEDPAR_ANALYSIS): indicator3 = 0; MPRINT(MEDPAR_ANALYSIS): indicator4 = 0; MPRINT(MEDPAR_ANALYSIS): indicator5 = 0; MPRINT(MEDPAR_ANALYSIS): indicator6 = 0; MPRINT(MEDPAR_ANALYSIS): indicator7 = 0; MPRINT(MEDPAR_ANALYSIS): indicator8 = 0; MPRINT(MEDPAR_ANALYSIS): indicator9 = 0; MPRINT(MEDPAR_ANALYSIS): indicator10 = 0; MPRINT(MEDPAR_ANALYSIS): indicator11 = 0; MPRINT(MEDPAR_ANALYSIS): indicator12 = 0; MPRINT(MEDPAR_ANALYSIS): indicator13 = 0; MPRINT(MEDPAR_ANALYSIS): indicator14 = 0; MPRINT(MEDPAR_ANALYSIS): indicator15 = 0; MPRINT(MEDPAR_ANALYSIS): indicator16 = 0; MPRINT(MEDPAR_ANALYSIS): indicator17 = 0; MPRINT(MEDPAR_ANALYSIS): indicator18 = 0; MPRINT(MEDPAR_ANALYSIS): indicator19 = 0; MPRINT(MEDPAR_ANALYSIS): indicator20 = 0; MPRINT(MEDPAR_ANALYSIS): indicator21 = 0; MPRINT(MEDPAR_ANALYSIS): indicator22 = 0; MPRINT(MEDPAR_ANALYSIS): indicator23 = 0; MPRINT(MEDPAR_ANALYSIS): indicator24 = 0; MPRINT(MEDPAR_ANALYSIS): indicator25 = 0; MPRINT(MEDPAR_ANALYSIS): indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in depression_codes then indicator1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in depression_codes then indicator2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in depression_codes then indicator3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in depression_codes then indicator4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in depression_codes then indicator5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in depression_codes then indicator6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in depression_codes then indicator7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in depression_codes then indicator8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in depression_codes then indicator9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in depression_codes then indicator10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in depression_codes then indicator11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in depression_codes then indicator12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in depression_codes then indicator13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in depression_codes then indicator14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in depression_codes then indicator15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in depression_codes then indicator16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in depression_codes then indicator17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in depression_codes then indicator18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in depression_codes then indicator19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in depression_codes then indicator20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in depression_codes then indicator21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in depression_codes then indicator22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in depression_codes then indicator23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in depression_codes then indicator24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in depression_codes then indicator25 = 1; MPRINT(MEDPAR_ANALYSIS): indicator_count=sum(of indicator1-indicator25); MPRINT(MEDPAR_ANALYSIS): if indicator_count > 0 then indicator_all = 1; MPRINT(MEDPAR_ANALYSIS): *this part of the code will assign a 1 to any depression codes; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if not missing(DGNS[i])then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then NONALZH_DEMEN_MEDPAR=1; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(NONALZH_DEMEN_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in alzhimers_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then NONALZH_DEMEN_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): *assigning -9 to missing DGNS values; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(NONALZH_DEMEN_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then NONALZH_DEMEN_MEDPAR =-9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_1 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_2 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_3 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_4 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_5 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_6 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_7 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_8 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_9 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_10 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_11 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_12 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_13 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_14 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_15 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_16 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_17 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_18 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_19 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_20 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_21 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_22 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_23 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_24 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_25 = 0; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in nonalzhimers_codes then nonalzhimers_indicator_1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in nonalzhimers_codes then nonalzhimers_indicator_2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in nonalzhimers_codes then nonalzhimers_indicator_3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in nonalzhimers_codes then nonalzhimers_indicator_4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in nonalzhimers_codes then nonalzhimers_indicator_5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in nonalzhimers_codes then nonalzhimers_indicator_6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in nonalzhimers_codes then nonalzhimers_indicator_7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in nonalzhimers_codes then nonalzhimers_indicator_8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in nonalzhimers_codes then nonalzhimers_indicator_9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in nonalzhimers_codes then nonalzhimers_indicator_10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in nonalzhimers_codes then nonalzhimers_indicator_11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in nonalzhimers_codes then nonalzhimers_indicator_12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in nonalzhimers_codes then nonalzhimers_indicator_13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in nonalzhimers_codes then nonalzhimers_indicator_14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in nonalzhimers_codes then nonalzhimers_indicator_15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in nonalzhimers_codes then nonalzhimers_indicator_16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in nonalzhimers_codes then nonalzhimers_indicator_17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in nonalzhimers_codes then nonalzhimers_indicator_18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in nonalzhimers_codes then nonalzhimers_indicator_19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in nonalzhimers_codes then nonalzhimers_indicator_20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in nonalzhimers_codes then nonalzhimers_indicator_21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in nonalzhimers_codes then nonalzhimers_indicator_22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in nonalzhimers_codes then nonalzhimers_indicator_23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in nonalzhimers_codes then nonalzhimers_indicator_24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in nonalzhimers_codes then nonalzhimers_indicator_25 = 1; MPRINT(MEDPAR_ANALYSIS): nonalzhimers_indicator_count = sum(of nonalzhimers_indicator_1-nonalzhimers_indicator_25); MPRINT(MEDPAR_ANALYSIS): if nonalzhimers_indicator_count > 0 then nonalzhimers_indicator_all = 1; MPRINT(MEDPAR_ANALYSIS): **************************************************************************************************** do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(ALZH_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0; NOTE: Line generated by the invoked macro "MEDPAR_ANALYSIS". 411 then ALZH_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 411 ! if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; end; end; do i = 1 to dim(DGNS) --- 161 411 ! ; if missing(ALZH_MEDPAR) then do; if missing(DGNS[i]) MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(ALZH_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then ALZH_MEDPAR = -9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_1 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_2 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_3 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_4 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_5 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_6 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_7 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_8 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_9 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_10 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_11 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_12 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_13 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_14 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_15 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_16 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_17 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_18 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_19 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_20 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_21 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_22 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_23 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_24 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_25 = 0; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_all = 0; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_1_CD) in alzhimers_codes then alzh_indicator_1 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_2_CD) in alzhimers_codes then alzh_indicator_2 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_3_CD) in alzhimers_codes then alzh_indicator_3 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_4_CD) in alzhimers_codes then alzh_indicator_4 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_5_CD) in alzhimers_codes then alzh_indicator_5 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_6_CD) in alzhimers_codes then alzh_indicator_6 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_7_CD) in alzhimers_codes then alzh_indicator_7 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_8_CD) in alzhimers_codes then alzh_indicator_8 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_9_CD) in alzhimers_codes then alzh_indicator_9 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_10_CD) in alzhimers_codes then alzh_indicator_10 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_11_CD) in alzhimers_codes then alzh_indicator_11 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_12_CD) in alzhimers_codes then alzh_indicator_12 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_13_CD) in alzhimers_codes then alzh_indicator_13 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_14_CD) in alzhimers_codes then alzh_indicator_14 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_15_CD) in alzhimers_codes then alzh_indicator_15 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_16_CD) in alzhimers_codes then alzh_indicator_16 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_17_CD) in alzhimers_codes then alzh_indicator_17 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_18_CD) in alzhimers_codes then alzh_indicator_18 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_19_CD) in alzhimers_codes then alzh_indicator_19 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_20_CD) in alzhimers_codes then alzh_indicator_20 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_21_CD) in alzhimers_codes then alzh_indicator_21 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_22_CD) in alzhimers_codes then alzh_indicator_22 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_23_CD) in alzhimers_codes then alzh_indicator_23 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_24_CD) in alzhimers_codes then alzh_indicator_24 = 1; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS_25_CD) in alzhimers_codes then alzh_indicator_25 = 1; MPRINT(MEDPAR_ANALYSIS): alzh_indicator_count = sum(of alzh_indicator_1-alzh_indicator_25); MPRINT(MEDPAR_ANALYSIS): if alzh_indicator_count > 0 then alzh_indicator_all = 1; ERROR 161-185: No matching DO/SELECT statement.
This line is the problem:
44657 *********************************************************************************************** 44657! *****
That is the START of a statement comment. Which ends with this line:
44663 do i = 1 to dim(DGNS);
So you have one fewer DO statements than END statements.
The log you posted is not for the macro you posted.
Are you sure the compilation of the macro worked? Perhaps you are still executing some earlier flaw definition of the macro?
When I run your posted code instead I get errors about your attempt to reference arrays that have not been defined.
ERROR: The right-hand operand must be an array name or a constant value list. The specified name depression_codes, is not an array.
MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0;
152 %macro medpar_analysis; 153 %do years=2019 %to 2019; 154 155 data output.merged_medpar_mbsf_pdpn_&years._1; 156 set output.merged_medpar_mbsf_pdpn_&years._1; 157 array DGNS[25] $ DGNS_1_CD -- DGNS_25_CD; 158 159 160 ALZH_MEDPAR = .; 161 162 array alzhimers_codes[4] $8 _temporary_ ('G300', 'G301','G308', 'G309'); 163 164 do i = 1 to dim(DGNS); 165 if not missing(DGNS[i]) then do; 166 if strip(DGNS[i]) in alzhimers_codes then ALZH_MEDPAR = 1; 167 end; 168 end; 169 170 /* Assign 0 to ALZH_MEDPAR for other diagnosis codes */ 171 do i = 1 to dim(DGNS); 172 if missing(ALZH_MEDPAR) then do; 173 if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0; 174 if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0; 175 if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0; 176 if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0; 177 if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0; 178 if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0; 179 if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0; 180 if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0; 181 if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0; 182 if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0; 183 if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0; 184 if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; 185 if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; 186 end; 187 end; 188 189 /* Assign -9 to ALZH_MEDPAR if all DGNS values are missing */ 190 do i = 1 to dim(DGNS); 191 if missing(ALZH_MEDPAR) then do; 192 if missing(DGNS[i]) then ALZH_MEDPAR = -9; 193 end; 194 end; 195 196 197 198 run; 199 200 %end; 201 %mend medpar_analysis; 202 options mprint; 203 %medpar_analysis; MPRINT(MEDPAR_ANALYSIS): data output.merged_medpar_mbsf_pdpn_2019_1; MPRINT(MEDPAR_ANALYSIS): set output.merged_medpar_mbsf_pdpn_2019_1; ERROR: Libref OUTPUT is not assigned. MPRINT(MEDPAR_ANALYSIS): array DGNS[25] $ DGNS_1_CD -- DGNS_25_CD; ERROR: Variable DGNS_1_CD cannot be found on the list of previously defined variables. ERROR: Too few variables defined for the dimension(s) specified for the array DGNS. MPRINT(MEDPAR_ANALYSIS): ALZH_MEDPAR = .; MPRINT(MEDPAR_ANALYSIS): array alzhimers_codes[4] $8 _temporary_ ('G300', 'G301','G308', 'G309'); MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if not missing(DGNS[i]) then do; MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in alzhimers_codes then ALZH_MEDPAR = 1; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(ALZH_MEDPAR) then do; ERROR: The right-hand operand must be an array name or a constant value list. The specified name depression_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name nonalzhimers_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name pneumonia_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name hf_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name prknsn_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name stroke_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name stroke_exclusion_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name anxiety_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name bipolar_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name TBI_codes, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name DRUG_USE_CODES, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name PSYCH_CODES, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; ERROR: The right-hand operand must be an array name or a constant value list. The specified name OUD_CODES, is not an array. MPRINT(MEDPAR_ANALYSIS): if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): do i = 1 to dim(DGNS); MPRINT(MEDPAR_ANALYSIS): if missing(ALZH_MEDPAR) then do; MPRINT(MEDPAR_ANALYSIS): if missing(DGNS[i]) then ALZH_MEDPAR = -9; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): end; MPRINT(MEDPAR_ANALYSIS): run; ERROR: Libref OUTPUT is not assigned. NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.00 seconds
@LuisMijares wrote:
sorry, I omitted part of the code, let me post the entire code, it's very long.
So the extra END statement is in the part you omitted.
%macro medpar_analysis; %do years=2019 %to 2021; data output.merged_medpar_mbsf_pdpn_&years._1; set output.merged_medpar_mbsf_pdpn_&years._1; array DGNS[25] $ DGNS_1_CD -- DGNS_25_CD; DEPRESSION_MEDPAR = .; NONALZH_DEMEN_MEDPAR = .; ALZH_MEDPAR = .; PNEUMO_MEDPAR = .; hf_medpar =.; PRKNSN_MEDPAR = .; STROKE_TIA_MEDPAR = .; ANXI_MEDICARE_MEDPAR =.; BIPOLAR_MEDPAR = .; TBI_MEDPAR = .; DRUGS_MEDPAR = .; SCHIOT_MEDPAR = .; OUD_ANY_MEDPAR = .; array depression_codes[50] $8 _temporary_ ('F0631', 'F0632', 'F310', 'F3110', 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 'F3161', 'F3162', 'F3163', 'F3164', 'F3171', 'F3173', 'F3175', 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 'F319', 'F320', 'F321', 'F322', 'F323', 'F324', 'F325', 'F328', 'F3289', 'F329', 'F32A', 'F330', 'F331', 'F332', 'F333', 'F3340', 'F3341', 'F3342', 'F338', 'F339', 'F340', 'F341', 'F4321', 'F4323'); array nonalzhimers_codes[84] $8 _temporary_ ('F0150', 'F0151', 'F01511', 'F01518', 'F0152', 'F0153', 'F0154', 'F01A0', 'F01A11', 'F01A18', 'F01A2', 'F01A3', 'F01A4', 'F01B0', 'F01B11', 'F01B18', 'F01B2', 'F01B3', 'F01B4', 'F01C0', 'F01C11', 'F01C18', 'F01C2', 'F01C3', 'F01C4', 'F0280', 'F0281', 'F02811', 'F02818', 'F0282', 'F0283', 'F0284', 'F02A0', 'F02A11', 'F02A18', 'F02A2', 'F02A3', 'F02A4', 'F02B0', 'F02B11', 'F02B18', 'F02B2', 'F02B3', 'F02B4', 'F02C0', 'F02C11', 'F02C18', 'F02C2', 'F02C3', 'F02C4', 'F0390', 'F0391', 'F03911', 'F03918', 'F0392', 'F0393', 'F0394', 'F03A0', 'F03A11', 'F03A18', 'F03A2', 'F03A3', 'F03A4', 'F03B0', 'F03B11', 'F03B18', 'F03B2', 'F03B3', 'F03B4', 'F03C0', 'F03C11', 'F03C18', 'F03C2', 'F03C3', 'F03C4', 'F05', 'G138', 'G3101', 'G3109', 'G311', 'G312', 'G3183', 'G94', 'R4181'); array alzhimers_codes[4] $8 _temporary_ ('G300', 'G301','G308', 'G309'); array pneumonia_codes[93] $8 _temporary_( 'A0103', 'A0222', 'A065', 'A202', 'A212', 'A221', 'A310', 'A3701', 'A3711', 'A3781', 'A3791', 'A403', 'A420', 'A430', 'A481', 'A5004', 'A5484', 'B012', 'B052', 'B0681', 'B371', 'B380', 'B382', 'B390', 'B392', 'B400', 'B402', 'B410', 'B583', 'B59', 'B664', 'B671', 'B7781', 'B953', 'B960', 'B961', 'J09X1', 'J1000', 'J1001', 'J1008', 'J1100', 'J1108', 'J120', 'J121', 'J122', 'J123', 'J1281', 'J1282', 'J1289', 'J129', 'J13', 'J14', 'J150', 'J151', 'J1520', 'J15211', 'J15212', 'J1529', 'J153', 'J154', 'J155', 'J156', 'J1561', 'J1569', 'J157', 'J158', 'J159', 'J160', 'J168', 'J17', 'J180', 'J181', 'J182', 'J188', 'J189', 'J200', 'J84111', 'J84116', 'J84117', 'J84178', 'J842', 'J851', 'J95851', 'P230', 'P231', 'P232', 'P233', 'P234', 'P235', 'P236', 'P238', 'P239', 'Z8701'); array hf_codes[34] $8 _temporary_ ( 'I0981', 'I110', 'I130', 'I132', 'I420', 'I425', 'I426', 'I427', 'I428', 'I43', 'I501', 'I5020', 'I5021', 'I5022', 'I5023', 'I5030', 'I5031', 'I5032', 'I5033', 'I5040', 'I5041', 'I5042', 'I5043', 'I50810', 'I50811', 'I50812', 'I50813', 'I50814', 'I5082', 'I5083', 'I5084', 'I5089', 'I509', 'P290'); array prknsn_codes[13] $8 _temporary_ ( 'G20', 'G20A1', 'G20A2', 'G20B1', 'G20B2', 'G20C', 'G2111', 'G2119', 'G213', 'G214', 'G218', 'G219', 'G3183'); array stroke_codes[150] $8 _temporary_ ( 'G450', 'G451', 'G452', 'G453', 'G458', 'G459', 'G460', 'G461', 'G462', 'G463', 'G464', 'G465', 'G466', 'G467', 'G468', 'G9731', 'G9732', 'I6000', 'I6001', 'I6002', 'I6010', 'I6011', 'I6012', 'I602', 'I6020', 'I6021', 'I6022', 'I6030', 'I6031', 'I6032', 'I604', 'I6050', 'I6051', 'I6052', 'I606', 'I607', 'I608', 'I609', 'I610', 'I611', 'I612', 'I613', 'I614', 'I615', 'I616', 'I618', 'I619', 'I6200', 'I6201', 'I6202', 'I629', 'I6300', 'I63011', 'I63012', 'I63013', 'I63019', 'I6302', 'I63031', 'I63032', 'I63033', 'I63039', 'I6309', 'I6310', 'I63111', 'I63112', 'I63113', 'I63119', 'I6312', 'I63131', 'I63132', 'I63133', 'I63139', 'I6319', 'I6320', 'I63211', 'I63212', 'I63213', 'I63219', 'I6322', 'I63231', 'I63232', 'I63233', 'I63239', 'I6329', 'I6330', 'I63311', 'I63312', 'I63313', 'I63319', 'I63321', 'I63322', 'I63323', 'I63329', 'I63331', 'I63332', 'I63333', 'I63339', 'I63341', 'I63342', 'I63343', 'I63349', 'I6339', 'I6340', 'I63411', 'I63412', 'I63413', 'I63419', 'I63421', 'I63422', 'I63423', 'I63429', 'I63431', 'I63432', 'I63433', 'I63439', 'I63441', 'I63442', 'I63443', 'I63449', 'I6349', 'I6350', 'I63511', 'I63512', 'I63513', 'I63519', 'I63521', 'I63522', 'I63523', 'I63529', 'I63531', 'I63532', 'I63533', 'I63539', 'I63541', 'I63542', 'I63543', 'I63549', 'I6359', 'I636', 'I638', 'I6381', 'I6389', 'I639', 'I67841', 'I67848', 'I6789', 'I97810', 'I97811', 'I97820', 'I97821'); array stroke_exclusion_codes[119] $8 _temporary_ ( 'S06340A', 'S06341A', 'S06342A', 'S06343A', 'S06344A', 'S06345A', 'S06346A', 'S06347A', 'S06348A', 'S0634AA', 'S06349A', 'S06350A', 'S06351A', 'S06352A', 'S06353A', 'S06354A', 'S06355A', 'S06356A', 'S06357A', 'S06358A', 'S0635AA', 'S06359A', 'S06360A', 'S06361A', 'S06362A', 'S06363A', 'S06364A', 'S06365A', 'S06366A', 'S06367A', 'S06368A', 'S0636AA', 'S06369A', 'S06370A', 'S06371A', 'S06372A', 'S06373A', 'S06374A', 'S06375A', 'S06376A', 'S06377A', 'S06378A', 'S0637AA', 'S06379A', 'S06380A', 'S06381A', 'S06382A', 'S06383A', 'S06384A', 'S06385A', 'S06386A', 'S06387A', 'S06388A', 'S0638AA', 'S06389A', 'S065X0A', 'S065X1A', 'S065X2A', 'S065X3A', 'S065X4A', 'S065X5A', 'S065X6A', 'S065X7A', 'S065X8A', 'S065XAA', 'S065X9A', 'S066X0A', 'S066X1A', 'S066X2A', 'S066X3A', 'S066X4A', 'S066X5A', 'S066X6A', 'S066X7A', 'S066X8A', 'S066XAA', 'S066X9A', 'S06810A', 'S06811A', 'S06812A', 'S06813A', 'S06814A', 'S06815A', 'S06816A', 'S06817A', 'S06818A', 'S0681AA', 'S06819A', 'S06820A', 'S06821A', 'S06822A', 'S06823A', 'S06824A', 'S06825A', 'S06826A', 'S06827A', 'S06828A', 'S0682AA', 'S06829A', 'S06890A', 'S06891A', 'S06892A', 'S06893A', 'S06894A', 'S06895A', 'S06896A', 'S06897A', 'S06898A', 'S0689AA', 'S06899A', 'S069X0A', 'S069X1A', 'S069X2A', 'S069X3A', 'S069X4A', 'S069X5A', 'S069X6A', 'S069X7A', 'S069X8A'); array anxiety_codes[49] $8 _temporary_ ( 'F064', 'F4000', 'F4001', 'F4002', 'F4010', 'F4011', 'F40210', 'F40218', 'F40220', 'F40228', 'F40230', 'F40231', 'F40232', 'F40233', 'F40240', 'F40241', 'F40242', 'F40243', 'F40248', 'F40290', 'F40291', 'F40298', 'F408', 'F409', 'F410', 'F411', 'F413', 'F418', 'F419', 'F42', 'F422', 'F423', 'F424', 'F428', 'F429', 'F430', 'F4310', 'F4311', 'F4312', 'F449', 'F458', 'F488', 'F489', 'F938', 'F99', 'R452', 'R455', 'R456', 'R457'); array bipolar_codes[42] $8 _temporary_ ( 'F3010', 'F3011', 'F3012', 'F3013', 'F302', 'F303', 'F304', 'F308', 'F309', 'F310', 'F3110', 'F3111', 'F3112', 'F3113', 'F312', 'F3130', 'F3131', 'F3132', 'F314', 'F315', 'F3160', 'F3161', 'F3162', 'F3163', 'F3164', 'F3170', 'F3171', 'F3172', 'F3173', 'F3174', 'F3175', 'F3176', 'F3177', 'F3178', 'F3181', 'F3189', 'F319', 'F338', 'F3481', 'F3489', 'F349', 'F39'); array TBI_codes [262] $8 _temporary_( 'F070', 'F0781', 'F0789', 'F482', 'S04011S', 'S04012S', 'S04019S', 'S0402XS', 'S04031S', 'S04032S', 'S04039S', 'S04041S', 'S04042S', 'S04049S', 'S0410XS', 'S0411XS', 'S0412XS', 'S0420XS', 'S0421XS', 'S0422XS', 'S0430XS', 'S0431XS', 'S0432XS', 'S0440XS', 'S0441XS', 'S0442XS', 'S0450XS', 'S0451XS', 'S0452XS', 'S0460XS', 'S0461XS', 'S0462XS', 'S0470XS', 'S0471XS', 'S0472XS', 'S04811S', 'S04812S', 'S04819S', 'S04891S', 'S04892S', 'S04899S', 'S049XXS', 'S060X0S', 'S060X1S', 'S060X2S', 'S060X3S', 'S060X4S', 'S060X5S', 'S060X6S', 'S060X7S', 'S060X8S', 'S060XAS', 'S060X9S', 'S061X0S', 'S061X1S', 'S061X2S', 'S061X3S', 'S061X4S', 'S061X5S', 'S061X6S', 'S061X7S', 'S061X8S', 'S061XAS', 'S061X9S', 'S062X0S', 'S062X1S', 'S062X2S', 'S062X3S', 'S062X4S', 'S062X5S', 'S062X6S', 'S062X7S', 'S062X8S', 'S062XAS', 'S062X9S', 'S06300S', 'S06301S', 'S06302S', 'S06303S', 'S06304S', 'S06305S', 'S06306S', 'S06307S', 'S06308S', 'S0630AS', 'S06309S', 'S06310S', 'S06311S', 'S06312S', 'S06313S', 'S06314S', 'S06315S', 'S06316S', 'S06317S', 'S06318S', 'S0631AS', 'S06319S', 'S06320S', 'S06321S', 'S06322S', 'S06323S', 'S06324S', 'S06325S', 'S06326S', 'S06327S', 'S06328S', 'S0632AS', 'S06329S', 'S06330S', 'S06331S', 'S06332S', 'S06333S', 'S06334S', 'S06335S', 'S06336S', 'S06337S', 'S06338S', 'S0633AS', 'S06339S', 'S06340S', 'S06341S', 'S06342S', 'S06343S', 'S06344S', 'S06345S', 'S06346S', 'S06347S', 'S06348S', 'S0634AS', 'S06349S', 'S06350S', 'S06351S', 'S06352S', 'S06353S', 'S06354S', 'S06355S', 'S06356S', 'S06357S', 'S06358S', 'S0635AS', 'S06359S', 'S06360S', 'S06361S', 'S06362S', 'S06363S', 'S06364S', 'S06365S', 'S06366S', 'S06367S', 'S06368S', 'S0636AS', 'S06369S', 'S06370S', 'S06371S', 'S06372S', 'S06373S', 'S06374S', 'S06375S', 'S06376S', 'S06377S', 'S06378S', 'S0637AS', 'S06379S', 'S06380S', 'S06381S', 'S06382S', 'S06383S', 'S06384S', 'S06385S', 'S06386S', 'S06387S', 'S06388S', 'S0638AS', 'S06389S', 'S064X0S', 'S064X1S', 'S064X2S', 'S064X3S', 'S064X4S', 'S064X5S', 'S064X6S', 'S064X7S', 'S064X8S', 'S064XAS', 'S064X9S', 'S065X0S', 'S065X1S', 'S065X2S', 'S065X3S', 'S065X4S', 'S065X5S', 'S065X6S', 'S065X7S', 'S065X8S', 'S065XAS', 'S065X9S', 'S066X0S', 'S066X1S', 'S066X2S', 'S066X3S', 'S066X4S', 'S066X5S', 'S066X6S', 'S066X7S', 'S066X8S', 'S066XAS', 'S066X9S', 'S06810S', 'S06811S', 'S06812S', 'S06813S', 'S06814S', 'S06815S', 'S06816S', 'S06817S', 'S06818S', 'S0681AS', 'S06819S', 'S06820S', 'S06821S', 'S06822S', 'S06823S', 'S06824S', 'S06825S', 'S06826S', 'S06827S', 'S06828S', 'S0682AS', 'S06829S', 'S068A0S', 'S068A1S', 'S068A2S', 'S068A3S', 'S068A4S', 'S068A5S', 'S068A6S', 'S068AAS', 'S068A9S', 'S06890S', 'S06891S', 'S06892S', 'S06893S', 'S06894S', 'S06895S', 'S06896S', 'S06897S', 'S06898S', 'S0689AS', 'S06899S', 'S069X0S', 'S069X1S', 'S069X2S', 'S069X3S', 'S069X4S', 'S069X5S', 'S069X6S', 'S069X7S', 'S069X8S', 'S069XAS', 'S069X9S', 'S06A0XS', 'S06A1XS'); array DRUG_USE_CODES[133] $8 _temporary_ ('HZ2ZZZZ', 'HZ30ZZZ', 'HZ31ZZZ', 'HZ32ZZZ', 'HZ33ZZZ', 'HZ34ZZZ', 'HZ35ZZZ', 'HZ36ZZZ', 'HZ37ZZZ', 'HZ38ZZZ', 'HZ39ZZZ', 'HZ3BZZZ', 'HZ40ZZZ', 'HZ93ZZZ', 'HZ96ZZZ' 'F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 'F1123', 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 'F11920', 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 'F11982', 'F11988', 'F1199', 'F1210', 'F12120', 'F12121', 'F12122', 'F12129', 'F1213', 'F12150', 'F12151', 'F12159', 'F12180', 'F12188', 'F1219', 'F1220', 'F12220', 'F12221', 'F12222', 'F12229', 'F12250', 'F1629', 'F1690', 'F16920', 'F16921', 'F16929', 'F1694', 'F16950', 'F16951', 'F16959', 'F16980', 'F16983', 'F16988', 'F1699', 'F17203', 'F17208', 'F17209', 'F17213', 'F17218', 'F17219', 'F17223', 'F17228', 'F17229', 'F17293', 'F17298', 'F17299', 'F1810', 'F18120', 'F18121', 'F18129', 'F1814', 'F18150', 'F18151', 'F18159', 'F1817', 'F18180', 'F18188', 'F1819', 'F1820', 'F18220', 'F18221', 'F18229', 'F1824', 'F18250', 'F18251', 'F18259', 'F1827', 'F18280', 'F18288', 'F1829', 'F1890', 'F18920', 'F18921', 'F18929', 'F1894', 'F18950', 'F18951', 'F18959', 'F1897'); array PSYCH_CODES[12] $8 _temporary_ ('F200', 'F201', 'F202', 'F203', 'F205', 'F2081', 'F2089', 'F209', 'F250', 'F251', 'F258', 'F259'); array OUD_codes[197] $8 _temporary_ ('F1110', 'F11120', 'F11121', 'F11122', 'F11129', 'F1113', 'F1114', 'F11150', 'F11151', 'F11159', 'F11181', 'F11182', 'F11188', 'F1119', 'F1120', 'F11220', 'F11221', 'F11222', 'F11229', 'F1123', 'F1124', 'F11250', 'F11251', 'F11259', 'F11281', 'F11282', 'F11288', 'F1129', 'F1190', 'F11920', 'F11921', 'F11922', 'F11929', 'F1193', 'F1194', 'F11950', 'F11951', 'F11959', 'F11981', 'F11982', 'F11988', 'F1199', 'HZ81ZZZ', 'HZ84ZZZ', 'HZ85ZZZ', 'HZ86ZZZ', 'HZ91ZZZ', 'HZ94ZZZ', 'HZ95ZZZ', 'HZ96ZZZ', 'T400X1A', 'T400X1D', 'T400X1S', 'T400X2A', 'T400X2D', 'T400X2S', 'T400X3A', 'T400X3D', 'T400X3S', 'T400X4A', 'T400X4D', 'T400X4S', 'T400X5A', 'T400X5D', 'T400X5S', 'T401X1A', 'T401X1D', 'T401X1S', 'T401X2A', 'T401X2D', 'T401X2S', 'T401X3A', 'T401X3D', 'T401X3S', 'T401X4A', 'T401X4D', 'T401X4S', 'T402X1A', 'T402X1D', 'T402X1S', 'T402X2A', 'T402X2D', 'T402X2S', 'T402X3A', 'T402X3D', 'T402X3S', 'T402X4A', 'T402X4D', 'T402X4S', 'T402X5A', 'T402X5D', 'T402X5S', 'T403X1A', 'T403X1D', 'T403X1S', 'T403X2A', 'T403X2D', 'T403X2S', 'T403X3A', 'T403X3D', 'T403X3S', 'T403X4A', 'T403X4D', 'T403X4S', 'T403X5A', 'T403X5D', 'T403X5S', 'T40411A', 'T40411D', 'T40411S', 'T40412A', 'T40412D', 'T40412S', 'T40413A', 'T40413D', 'T40413S', 'T40414A', 'T40414D', 'T40414S', 'T40415A', 'T40415D', 'T40415S', 'T40421A', 'T40421D', 'T40421S', 'T40422A', 'T40422D', 'T40422S', 'T40423A', 'T40423D', 'T40423S', 'T40424A', 'T40424D', 'T40424S', 'T40425A', 'T40425D', 'T40425S', 'T40491A', 'T40491D', 'T40491S', 'T40492A', 'T40492D', 'T40492S', 'T40493A', 'T40493D', 'T40493S', 'T40494A', 'T40494D', 'T40494S', 'T40495A', 'T40495D', 'T40495S', 'T404X1A', 'T404X1D', 'T404X1S', 'T404X2A', 'T404X2D', 'T404X2S', 'T404X3A', 'T404X3D', 'T404X3S', 'T404X4A', 'T404X4D', 'T404X4S', 'T404X5A', 'T404X5D', 'T404X5S', 'T40601A', 'T40601D', 'T40601S', 'T40602A', 'T40602D', 'T40602S', 'T40603A', 'T40603D', 'T40603S', 'T40604A', 'T40604D', 'T40604S', 'T40605A', 'T40605D', 'T40605S', 'T40691A', 'T40691D', 'T40691S', 'T40692A', 'T40692D', 'T40692S', 'T40693A', 'T40693D', 'T40693S', 'T40694A', 'T40694D', 'T40694S', 'T40695A', 'T40695D', 'T40695S'); /* if strip(DGNS[i]) in nonalzhimers_codes then medical_indicator = -1; if strip(DGNS[i]) in alzhimers_codes then medical_indicator = -2; if strip(DGNS[i]) in pneumonia_codes then medical_indicator = -3; if strip(DGNS[i]) in hf_codes then medical_indicator = -4; if strip(DGNS[i]) in prknsn_codes then medical_indicator = -5; if strip(DGNS[i]) in stroke_codes then medical_indicator = -6; if strip(DGNS[i]) in stroke_exclusion_codes then medical_indicator = -7; if strip(DGNS[i]) in anxiety_codes then medical_indicator = -8; if strip(DGNS[i]) in bipolar_codes then medical_indicator = -9; if strip(DGNS[i]) in TBI_codes then medical_indicator = 10; if strip(DGNS[i]) in DRUG_USE_CODES then medical_indicator = -11; if strip(DGNS[i]) in PSYCH_CODES then medical_indicator = -12; if strip(DGNS[i]) in OUD_CODES then medical_indicator = -13; */ /* DEPRESSION_MEDPAR*/ /*this part of the code will assign a 1 to any depression codes*/ do i = 1 to dim(DGNS); if not missing(DGNS[i])then do; if strip(DGNS[i]) in depression_codes then DEPRESSION_MEDPAR=1; end; end; /* this part of the code will an a 0 to the depression indicator if there are any diagnosis codes*/ do i = 1 to dim(DGNS); if missing(DEPRESSION_MEDPAR) then do; if strip(DGNS[i]) in nonalzhimers_codes then DEPRESSION_MEDPAR =0; if strip(DGNS[i]) in alzhimers_codes then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in pneumonia_codes then DEPRESSION_MEDPAR= 0; if strip(DGNS[i]) in hf_codes then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in prknsn_codes then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in stroke_codes then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in stroke_exclusion_codes then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in anxiety_codes then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in bipolar_codes then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in TBI_codes then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in DRUG_USE_CODES then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then DEPRESSION_MEDPAR = 0; if strip(DGNS[i]) in OUD_CODES then DEPRESSION_MEDPAR = 0; end; end; *assigning -9 to missing DGNS values; do i = 1 to dim(DGNS); if missing(DEPRESSION_MEDPAR) then do; if missing(DGNS[i]) then DEPRESSION_MEDPAR =-9; end; end; * end; /* verifying*/ indicator1 = 0; indicator2 = 0; indicator3 = 0; indicator4 = 0; indicator5 = 0; indicator6 = 0; indicator7 = 0; indicator8 = 0; indicator9 = 0; indicator10 = 0; indicator11 = 0; indicator12 = 0; indicator13 = 0; indicator14 = 0; indicator15 = 0; indicator16 = 0; indicator17 = 0; indicator18 = 0; indicator19 = 0; indicator20 = 0; indicator21 = 0; indicator22 = 0; indicator23 = 0; indicator24 = 0; indicator25 = 0; indicator_all = 0; if strip(DGNS_1_CD) in depression_codes then indicator1 = 1; if strip(DGNS_2_CD) in depression_codes then indicator2 = 1; if strip(DGNS_3_CD) in depression_codes then indicator3 = 1; if strip(DGNS_4_CD) in depression_codes then indicator4 = 1; if strip(DGNS_5_CD) in depression_codes then indicator5 = 1; if strip(DGNS_6_CD) in depression_codes then indicator6 = 1; if strip(DGNS_7_CD) in depression_codes then indicator7 = 1; if strip(DGNS_8_CD) in depression_codes then indicator8 = 1; if strip(DGNS_9_CD) in depression_codes then indicator9 = 1; if strip(DGNS_10_CD) in depression_codes then indicator10 = 1; if strip(DGNS_11_CD) in depression_codes then indicator11 = 1; if strip(DGNS_12_CD) in depression_codes then indicator12 = 1; if strip(DGNS_13_CD) in depression_codes then indicator13 = 1; if strip(DGNS_14_CD) in depression_codes then indicator14 = 1; if strip(DGNS_15_CD) in depression_codes then indicator15 = 1; if strip(DGNS_16_CD) in depression_codes then indicator16 = 1; if strip(DGNS_17_CD) in depression_codes then indicator17 = 1; if strip(DGNS_18_CD) in depression_codes then indicator18 = 1; if strip(DGNS_19_CD) in depression_codes then indicator19 = 1; if strip(DGNS_20_CD) in depression_codes then indicator20 = 1; if strip(DGNS_21_CD) in depression_codes then indicator21 = 1; if strip(DGNS_22_CD) in depression_codes then indicator22 = 1; if strip(DGNS_23_CD) in depression_codes then indicator23 = 1; if strip(DGNS_24_CD) in depression_codes then indicator24 = 1; if strip(DGNS_25_CD) in depression_codes then indicator25 = 1; indicator_count=sum(of indicator1-indicator25); if indicator_count > 0 then indicator_all = 1; /****************************************************/ /* Nonalzhimers_MEDPAR*/ *this part of the code will assign a 1 to any depression codes; do i = 1 to dim(DGNS); if not missing(DGNS[i])then do; if strip(DGNS[i]) in nonalzhimers_codes then NONALZH_DEMEN_MEDPAR=1; end; end; /* this part of the code will an a 0 to the depression indicator if there are any diagnosis codes*/ do i = 1 to dim(DGNS); if missing(NONALZH_DEMEN_MEDPAR) then do; if strip(DGNS[i]) in depression_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in alzhimers_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in pneumonia_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in hf_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in prknsn_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in stroke_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in stroke_exclusion_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in anxiety_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in bipolar_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in TBI_codes then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in DRUG_USE_CODES then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then NONALZH_DEMEN_MEDPAR = 0; if strip(DGNS[i]) in OUD_CODES then NONALZH_DEMEN_MEDPAR = 0; end; end; *assigning -9 to missing DGNS values; do i = 1 to dim(DGNS); if missing(NONALZH_DEMEN_MEDPAR) then do; if missing(DGNS[i]) then NONALZH_DEMEN_MEDPAR =-9; end; end; /* verifying*/ /* Initialize non-alzheimer indicators to 0 */ nonalzhimers_indicator_1 = 0; nonalzhimers_indicator_2 = 0; nonalzhimers_indicator_3 = 0; nonalzhimers_indicator_4 = 0; nonalzhimers_indicator_5 = 0; nonalzhimers_indicator_6 = 0; nonalzhimers_indicator_7 = 0; nonalzhimers_indicator_8 = 0; nonalzhimers_indicator_9 = 0; nonalzhimers_indicator_10 = 0; nonalzhimers_indicator_11 = 0; nonalzhimers_indicator_12 = 0; nonalzhimers_indicator_13 = 0; nonalzhimers_indicator_14 = 0; nonalzhimers_indicator_15 = 0; nonalzhimers_indicator_16 = 0; nonalzhimers_indicator_17 = 0; nonalzhimers_indicator_18 = 0; nonalzhimers_indicator_19 = 0; nonalzhimers_indicator_20 = 0; nonalzhimers_indicator_21 = 0; nonalzhimers_indicator_22 = 0; nonalzhimers_indicator_23 = 0; nonalzhimers_indicator_24 = 0; nonalzhimers_indicator_25 = 0; nonalzhimers_indicator_all = 0; /* Check DGNS_X_CD variables against nonalzhimers_codes */ if strip(DGNS_1_CD) in nonalzhimers_codes then nonalzhimers_indicator_1 = 1; if strip(DGNS_2_CD) in nonalzhimers_codes then nonalzhimers_indicator_2 = 1; if strip(DGNS_3_CD) in nonalzhimers_codes then nonalzhimers_indicator_3 = 1; if strip(DGNS_4_CD) in nonalzhimers_codes then nonalzhimers_indicator_4 = 1; if strip(DGNS_5_CD) in nonalzhimers_codes then nonalzhimers_indicator_5 = 1; if strip(DGNS_6_CD) in nonalzhimers_codes then nonalzhimers_indicator_6 = 1; if strip(DGNS_7_CD) in nonalzhimers_codes then nonalzhimers_indicator_7 = 1; if strip(DGNS_8_CD) in nonalzhimers_codes then nonalzhimers_indicator_8 = 1; if strip(DGNS_9_CD) in nonalzhimers_codes then nonalzhimers_indicator_9 = 1; if strip(DGNS_10_CD) in nonalzhimers_codes then nonalzhimers_indicator_10 = 1; if strip(DGNS_11_CD) in nonalzhimers_codes then nonalzhimers_indicator_11 = 1; if strip(DGNS_12_CD) in nonalzhimers_codes then nonalzhimers_indicator_12 = 1; if strip(DGNS_13_CD) in nonalzhimers_codes then nonalzhimers_indicator_13 = 1; if strip(DGNS_14_CD) in nonalzhimers_codes then nonalzhimers_indicator_14 = 1; if strip(DGNS_15_CD) in nonalzhimers_codes then nonalzhimers_indicator_15 = 1; if strip(DGNS_16_CD) in nonalzhimers_codes then nonalzhimers_indicator_16 = 1; if strip(DGNS_17_CD) in nonalzhimers_codes then nonalzhimers_indicator_17 = 1; if strip(DGNS_18_CD) in nonalzhimers_codes then nonalzhimers_indicator_18 = 1; if strip(DGNS_19_CD) in nonalzhimers_codes then nonalzhimers_indicator_19 = 1; if strip(DGNS_20_CD) in nonalzhimers_codes then nonalzhimers_indicator_20 = 1; if strip(DGNS_21_CD) in nonalzhimers_codes then nonalzhimers_indicator_21 = 1; if strip(DGNS_22_CD) in nonalzhimers_codes then nonalzhimers_indicator_22 = 1; if strip(DGNS_23_CD) in nonalzhimers_codes then nonalzhimers_indicator_23 = 1; if strip(DGNS_24_CD) in nonalzhimers_codes then nonalzhimers_indicator_24 = 1; if strip(DGNS_25_CD) in nonalzhimers_codes then nonalzhimers_indicator_25 = 1; /* Sum the indicators and check for at least one match */ nonalzhimers_indicator_count = sum(of nonalzhimers_indicator_1-nonalzhimers_indicator_25); if nonalzhimers_indicator_count > 0 then nonalzhimers_indicator_all = 1; **************************************************************************************************** /* Alzhimers diagnosis*/ /*Assign 1 to ALZH_MEDPAR for matches in alzhimers_codes; do i = 1 to dim(DGNS); if not missing(DGNS[i]) then do; if strip(DGNS[i]) in alzhimers_codes then ALZH_MEDPAR = 1; end; end; /* Assign 0 to ALZH_MEDPAR for other diagnosis codes */ do i = 1 to dim(DGNS); if missing(ALZH_MEDPAR) then do; if strip(DGNS[i]) in depression_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in nonalzhimers_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in pneumonia_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in hf_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in prknsn_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in stroke_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in stroke_exclusion_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in anxiety_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in bipolar_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in TBI_codes then ALZH_MEDPAR = 0; if strip(DGNS[i]) in DRUG_USE_CODES then ALZH_MEDPAR = 0; if strip(DGNS[i]) in PSYCH_CODES then ALZH_MEDPAR = 0; if strip(DGNS[i]) in OUD_CODES then ALZH_MEDPAR = 0; end; end; /* Assign -9 to ALZH_MEDPAR if all DGNS values are missing */ do i = 1 to dim(DGNS); if missing(ALZH_MEDPAR) then do; if missing(DGNS[i]) then ALZH_MEDPAR = -9; end; end; /* verifying*/ /* Initialize alzheimer indicators to 0 */ alzh_indicator_1 = 0; alzh_indicator_2 = 0; alzh_indicator_3 = 0; alzh_indicator_4 = 0; alzh_indicator_5 = 0; alzh_indicator_6 = 0; alzh_indicator_7 = 0; alzh_indicator_8 = 0; alzh_indicator_9 = 0; alzh_indicator_10 = 0; alzh_indicator_11 = 0; alzh_indicator_12 = 0; alzh_indicator_13 = 0; alzh_indicator_14 = 0; alzh_indicator_15 = 0; alzh_indicator_16 = 0; alzh_indicator_17 = 0; alzh_indicator_18 = 0; alzh_indicator_19 = 0; alzh_indicator_20 = 0; alzh_indicator_21 = 0; alzh_indicator_22 = 0; alzh_indicator_23 = 0; alzh_indicator_24 = 0; alzh_indicator_25 = 0; alzh_indicator_all = 0; /* Check DGNS_X_CD variables against alzhimers_codes */ if strip(DGNS_1_CD) in alzhimers_codes then alzh_indicator_1 = 1; if strip(DGNS_2_CD) in alzhimers_codes then alzh_indicator_2 = 1; if strip(DGNS_3_CD) in alzhimers_codes then alzh_indicator_3 = 1; if strip(DGNS_4_CD) in alzhimers_codes then alzh_indicator_4 = 1; if strip(DGNS_5_CD) in alzhimers_codes then alzh_indicator_5 = 1; if strip(DGNS_6_CD) in alzhimers_codes then alzh_indicator_6 = 1; if strip(DGNS_7_CD) in alzhimers_codes then alzh_indicator_7 = 1; if strip(DGNS_8_CD) in alzhimers_codes then alzh_indicator_8 = 1; if strip(DGNS_9_CD) in alzhimers_codes then alzh_indicator_9 = 1; if strip(DGNS_10_CD) in alzhimers_codes then alzh_indicator_10 = 1; if strip(DGNS_11_CD) in alzhimers_codes then alzh_indicator_11 = 1; if strip(DGNS_12_CD) in alzhimers_codes then alzh_indicator_12 = 1; if strip(DGNS_13_CD) in alzhimers_codes then alzh_indicator_13 = 1; if strip(DGNS_14_CD) in alzhimers_codes then alzh_indicator_14 = 1; if strip(DGNS_15_CD) in alzhimers_codes then alzh_indicator_15 = 1; if strip(DGNS_16_CD) in alzhimers_codes then alzh_indicator_16 = 1; if strip(DGNS_17_CD) in alzhimers_codes then alzh_indicator_17 = 1; if strip(DGNS_18_CD) in alzhimers_codes then alzh_indicator_18 = 1; if strip(DGNS_19_CD) in alzhimers_codes then alzh_indicator_19 = 1; if strip(DGNS_20_CD) in alzhimers_codes then alzh_indicator_20 = 1; if strip(DGNS_21_CD) in alzhimers_codes then alzh_indicator_21 = 1; if strip(DGNS_22_CD) in alzhimers_codes then alzh_indicator_22 = 1; if strip(DGNS_23_CD) in alzhimers_codes then alzh_indicator_23 = 1; if strip(DGNS_24_CD) in alzhimers_codes then alzh_indicator_24 = 1; if strip(DGNS_25_CD) in alzhimers_codes then alzh_indicator_25 = 1; /* Sum the indicators and check for at least one match */ alzh_indicator_count = sum(of alzh_indicator_1-alzh_indicator_25); if alzh_indicator_count > 0 then alzh_indicator_all = 1; %end; %mend medpar_analysis; %medpar_analysis;
Remove the
*
end;
comment from your code and try it again.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.