thank you to all for the answers. following is an example of what i need. as for the operations it is not to be performed often, so I can afford to bring the data soon in sas and then perform the join. another thing that i forgot and is not in the example is that I can have multiple records for the key (X,Y,M) in dataset A, though not frequently. In that case let's suppose I need variables from one record randomly for the moment data A; input X $ Y $ M Z $ var1 ; cards; A 0001 1 P 10 A 0001 2 P 11 A 0001 3 P 12 A 0001 4 P 13 A 0001 8 P 17 A 0001 9 P 18 A 0001 10 P 20 A 0002 4 P 21 A 0002 5 P 23 A 0002 6 P 25 A 0002 7 P 27 A 0002 8 P 27 A 0002 9 P 20 A 0002 10 P 15 A 0002 11 P 14 A 0002 12 P 12 B 0041 1 F 18 B 0041 2 F 18 B 0041 3 F 19 B 0041 4 F 20 B 0041 5 F 21 B 0041 6 F 17 B 0041 7 F 17 B 0041 8 F 17 B 0041 9 F 20 ; run; data B; input X $ Y $ M S $ var2 ; cards; A 0001 5 E 4 A 0001 6 E 4 A 0001 7 E 6 A 0001 10 O 2 A 0001 12 E 6 A 0002 3 E 4 B 0041 8 O 5 B 0041 9 O 6 B 0041 10 E 6 B 0041 11 E 6 ; run; data A_after; infile datalines delimiter=','; input X $ Y $ M Z $ var1 S $ var2; cards; A,0001,1,P,10, , A,0001,2,P,11, , A,0001,3,P,12, , A,0001,4,P,13, , A,0001,5,P,13,E,4 A,0001,6,P,13,E,4 A,0001,7,P,13,E,6 A,0001,8,P,17, , A,0001,9,P,18, , A,0001,10,P,20,O,2 A,0001,12,P,20,E,6 A,0002,3,P,21,E,4 A,0002,4,P,21, , A,0002,5,P,23, , A,0002,6,P,25, , A,0002,7,P,27, , A,0002,8,P,27, , A,0002,9,P,20, , A,0002,10,P,15, , A,0002,11,P,14, , A,0002,12,P,12, , B,0041,1,F,18, , B,0041,2,F,18, , B,0041,3,F,19, , B,0041,4,F,20, , B,0041,5,F,21, , B,0041,6,F,17, , B,0041,7,F,17, , B,0041,8,F,17,O,5 B,0041,9,F,20,O,6 B,0041,10,F,20,E,6 B,0041,11,F,20,E,6 ; run; xcen > it
... View more