Hi! given these data: data have; infile datalines delimiter=','; input id1 $ id2 $; datalines; M,A A,B C,D B,C V,W W,X X,Y Y,Z ; I am hoping to create a grouper ID that will associate M to A, A to B, B to C, and C to D. Same thing with V to W, W to X, X to Y and Y to Z. Please see below for the data I want: data want; infile datalines delimiter=','; input id1 $ id2 $ grouper; datalines; M,A,1 A,B,1 B,C,1 C,D,1 V,W,2 W,X,2 X,Y,2 Y,Z,2 ; So, in the output, there are 2 groups that are established. Is this possible using SAS 9.4? Please note that I cannot guarantee sort order so ideally the solution does not use first/last/lag commands. TIA!
... View more