Unfortunately using the IN operator here won't work since SAS interprets this statement:
if diagnoses in ('J45.10', 'J45.20', 'J45.30') then AI=1;
as:
if diagnoses ='J45.10' or diagnoses ='J45.20' or diagnoses ='J45.30' then AI=1;
Based on the example you provided for the values of Diagnoses, none of these conditions would ever result to True since they are much longer strings.
What you could use instead is the FIND function which would allow you to search for a substring of characters within the variable Diagnoses like so:
if find(diagnoses,"J45.10",'i')>0 then AI=1;
Since the FIND fuction will return the starting position of the substring within the string, you're looking for a value >0 to confirm whether it is present.
... View more