Hi Expert, I asked this question yesterday and got the result. I manipulated few data today but the output is not working correctly. My criteria is to retrieve records from child table when country, product (using like operator logic) and dosage matches with same variable in table parent. For combination of product, I don't want those records like 105 e.g. product mention in child table for record 105 is Gelusil where as the same product is available in parent table as in combination (Gelusil+Amlopidine). How to ignore this type of records for this column or any alternative data Child;
input pid country $ product & $25. dosage $;
cards;
101 France Atorvastatin Oral
102 France PaRacetamol .
103 Russia Nimusulide injection sc
104 China DIovan Tablet
105 Japan Gelusil Tablet
106 India Codeine+phosphate Tablet
;
run;
data Parent;
input country $ product & $25. dosage $;
cards;
JapaN Atorvastatin calcium Oral
China Atorvastatin Oral
France Atorvastatin calcium Oral
Russia Paracetamol Oral
India Paracetamol Oral
France Paracetamol Oral
RusSia Nimusulide sc
China diovan Syrup .
China diovan .
Japan Gelusil+Amlopidine Tablet
india Codeine+phosphate+salt Tablet
Japan Gelusil Tablet .
;
run;
proc sql;
create table match_country_prod_dos as
select A.*
from CHILD A
where exists(select distinct B.COUNTRY from PARENT B where (upcase(strip(B.COUNTRY))=upcase(strip(A.COUNTRY))
and index(upcase(strip(B.DOSAGE)), upcase(strip(A.DOSAGE))) >0 and index(upcase(strip(B.PRODUCT)),upcase(strip(A.PRODUCT)))>0));
quit;
... View more