Dear SAS community
I used this code to search a text field (procedure_name) but it yielded wrong data in all of the "pro_" fields. But the if I use .... where procedure_name contains xxx then the results make sense so I know this field has searchable text.
Could you please tell me what is wrong with my code using index function?
data procedure1; set procedure; pro_icd=0; pro_pacer=0; pro_emb=0; pro_cabg=0; pro_pci=0; pro_valvesurg=0; pro_codeblue=0; pro_ett=0; pro_ablation=0; pro_cor_angio=0; pro_ccta=0; pro_ccs=0; if index(lowcase(procedure_name), "defibrillator")=1 then pro_icd=1; if index(lowcase(procedure_name), "pacemaker")=1 then pro_pacer=1; if index(lowcase(procedure_name), "biopsy of heart")=1 then pro_emb=1; if indexc(lowcase(procedure_name), "bypass coronary artery","cardiac bypass graft surgery","coronary artery bypass")=1 then pro_cabg=1; if index(lowcase(procedure_name), "dilation of coronary artery")=1 then pro_pci=1; if index(lowcase(procedure_name), "cardiac valve replacement")=1 then pro_valvesurg=1; if index(lowcase(procedure_name), "cardiopulmonary resusitation")=1 then pro_codeblue=1; if index(lowcase(procedure_name), "cardiovascular stress test")=1 then pro_ett=1; if index(lowcase(procedure_name), "ablation")=1 and index(lowcase(procedure_name), "heart")=1 then pro_ablation=1; if indexc(lowcase(procedure_name), "coronary angiography","coronary arteriography")=1 then pro_cor_angio=1; if index(lowcase(procedure_name), "heart")=1 and indexc(lowcase(procedure_name), "catheterization")=1 then pro_cor_angio=1; if indexc(lowcase(procedure_name), "computed tomographic angiography, heart, coronary arteries")=1 then pro_ccta=1; if index(lowcase(procedure_name), "coronary calcium")=1 then pro_ccs=1; keep empi procedure_name code pro_test:; run;
Thanks so much in advance
... View more