I have a dataset that contains procedure codes ranging from 1 to 12 (cpt_code1-cpt_code12), that were performed on the same day. I need to search across these variables for specific codes that are related to a specific test being carried on on a patient. The codes related to each procedure are listed below: Test1: 81507, 84702 Test2: 84163, 84702, 76813 Test3: 82677, 84702, 86336 Test4: 82105, 84702, 86336, 82677 Note that all the codes listed for each test need to exist in the same row (i.e.cpt_code1-cpt_code12) for that test to be valid. In other words, let's say for a specific person, their row only contains cpt code 81507, I wouldn't be able to classify them as receiving Test1 since cpt code 84702 is not included in that line. I've tried searching previous forums (and reading about arrays) but I can't seem to find anything that matches my situation. Below is a snippet of what I have so far: data work.example2; length test_type $20.; set work.example; array acpt_code(1:12) cpt_code1-cpt_code12; do i=1 to 12; if acpt_code[i] in ('81507', '84702') then test_type="Test1"; end; run; I know the above code is not correct since I'm just telling SAS to search across the variables to see if at least one of the cpt codes exist, and I need to know that both codes exist in order for Test1 to be assigned as the test type (which is where I'm stuck). Thanks in advance!
... View more