Hi guys,
suppose to have the following two datasets:
data DB;
input ID $20. Codes Index_1;
cards;
0001 2134 1
0001 87 0
0002 154 1
0002 65 0
0003 88 1
0003 34 0
0003 78 0
run;
data DB1;
input Codes Index_2;
cards;
2134 6
87 4
154 2
65 6
88 1
34 3
78 5
run;
Is there a way to add Index_2 from DB1 to DB only when Index_1 from DB is = 1 to get the following?
data DB2;
input ID $20. Codes Index_1 Index_2;
cards;
0001 2134 1 6
0001 87 0 0
0002 154 1 2
0002 65 0 0
0003 88 1 1
0003 34 0 0
0003 78 0 0
run;
Thank you in advance