Hello, I am trying to generate the count of times any of the strings in a list appears in each row. I am using a big data, with many columns, but the columns of interest start with D_I10_ . This dataset has ICD codes for every visit a patient makes to the hospital. But I am interested to find out the number of times a patient ended up with an alcohol related ICD code in the hospital. The ICD codes of each visit is listed in columns starting with D_I10_ . Here is what I have done so far: data home.new2; set home.new; array d1 D_I10_; /*this is trying to tell which columns to pick*/ array c{3} $ 4 _temporary_ ('X45' 'Y15' 'X65'); /* these are the strings I am interested in, there are way more than three, so I need an automatic way to do it*/ visits=0; /* this is just stating the variable i want to make, which is # of visits based on those string appearance*/ do i= 1 to dim(d1); /* this is a attempt to do the counting*/ if whichc(d1[i],of c(*))>0 then do visit=visit+count(whichc(d1[i],of c(*))>0);leave;end; end; run; Any help will be greatly appreciated 🙂 Neyousha
... View more