Hi guys,
suppose to have the following dataset:
data DB1;
input ID :$20. Admission :date09. Discharge :date09. Var1 Var2 Var3;
cards;
8 10NOV2014 15NOV2014 44022 25000 4019
8 18SEP2015 19SEP2015 4552
8 03APR2017 05APR2017 85201 5761 57450
170 27JAN2020 31JAN2020 0039 5849 42731
170 06DEC2016 14DEC2016 4280 5119 40211
170 14MAY2015 21MAY2015 4280 49120
166 19AUG2016 24AUG2016 035 4019
166 27APR2017 16MAY2017 81221 V1588
166 20JAN2018 28JAN2018 72665
;
run;
Then another dataset with a list:
data DB2;
input MyVariable;
cards;
440
455
852
428
726
run;
I would like to subset from DB1 only rows where Var* match the first 3 integers of MyVariable in DB2 to get the following:
data DB3;
input ID :$20. Admission :date09. Discharge :date09. Var1 Var2 Var3;
cards;
8 10NOV2014 15NOV2014 44022 25000 4019
8 18SEP2015 19SEP2015 4552
8 03APR2017 05APR2017 85201 5761 57450
170 06DEC2016 14DEC2016 4280 5119 40211
170 14MAY2015 21MAY2015 4280 49120
166 20JAN2018 28JAN2018 72665
;
run;
Can anyone help me please?
Thank you in advance