Thank you for your help with this. I am not able to make your code work, but I got it to work in a really poor way. Here is my code: data data work.ind14_15_16; set bkm.alertes_bankmate_conv; by objet; retain count_gafi count_sanction count_person ; switch = "n"; if _n_ eq 1 then do; count_gafi=0; count_sanction=0; count_person=0; end; if index(lowcase(strip(objet)),'bolivie')>0 or index(lowcase(strip(objet)),'équateur')>0 or index(lowcase(strip(objet)),'equateur')>0 or index(lowcase(strip(objet)),'éthiopie')>0 or index(lowcase(strip(objet)),'ethiopie')>0 or index(lowcase(strip(objet)),'indonésie')>0 or index(lowcase(strip(objet)),'indonesie')>0 or index(lowcase(strip(objet)),'kenya')>0 or index(lowcase(strip(objet)),'nigeria')>0 or index(lowcase(strip(objet)),'nigéria')>0 or index(lowcase(strip(objet)),'pakistan')>0 or index(lowcase(strip(objet)),'sao')>0 or index(lowcase(strip(objet)),'sri lanka')>0 or index(lowcase(strip(objet)),'thailand')>0 or index(lowcase(strip(objet)),'tailand')>0 or index(lowcase(strip(objet)),'turquie')>0 or index(lowcase(strip(objet)),'tanzanie')>0 or index(lowcase(strip(objet)),'viet')>0 or index(lowcase(strip(objet)),'yemen')>0 or index(lowcase(strip(objet)),'yémen')>0 then do; count_gafi=count_gafi+1; switch = "y"; end; if index(lowcase(strip(objet)),'bélarus')>0 or index(lowcase(strip(objet)),'belarus' )>0 or index(lowcase(strip(objet)),'corée du nord' )>0 or index(lowcase(strip(objet)),'rpdc' )>0 or index(lowcase(strip(objet)),'coree du nord')>0 or index(lowcase(strip(objet)),'ivoire' )>0 or index(lowcase(strip(objet)),'congo' )>0 or index(lowcase(strip(objet)),'chine' )>0 or index(lowcase(strip(objet)), 'cuba' )>0 or index(lowcase(strip(objet)),'érythrée' )>0 or index(lowcase(strip(objet)), 'erythree')>0 or index(lowcase(strip(objet)), 'iran' )>0 or index(lowcase(strip(objet)),'iraq' )>0 or index(lowcase(strip(objet)), 'liberia' )>0 or index(lowcase(strip(objet)),'libéria' )>0 or index(lowcase(strip(objet)),'libye' )>0 or index(lowcase(strip(objet)),'myanmar' )>0 or index(lowcase(strip(objet)),'birmanie')>0 or index(lowcase(strip(objet)), 'somalie' )>0 or index(lowcase(strip(objet)),'sierra' )>0 or index(lowcase(strip(objet)), 'soudan')>0 or index(lowcase(strip(objet)), 'syrie' )>0 or index(lowcase(strip(objet)),'zimbabwe')>0 then do; count_sanction=count_sanction+1; switch = "y"; end; if switch ="n" then do; count_person = count_person + 1; /* If the record is not part of count_gafi or count_sanction, I want it to be part of count_person */ end; run; I would like to know what is the most efficient way to write the above and how to create a distinct table only with the count_sanction, count_gafi and count_person. Thank you for your help and time!
... View more