Hello and thank you in advance, I want to output to two different datasets and use a counter variable in each data set that counts separately. Like so: data have; infile datalines dlm=','; input blah $ var1 var2 ; datalines; a, 1, 2, b, 3, 2, c, 3, 3, d, 8, 4, e, 5, 6, f, 7, 2, g, 3, 1, h, 9, 4, i, 8, 9 ; run; data want1 want2; set have; if blah in ('a', 'b', 'c', 'd') then do; do i=1 to (total number of records but I don't know how to specify that); recordno=i; output want1; end; end; else do; do i=1 to total obs in that dataset; recordno=i; output want2; end; end; run; With the result that looks something like this: Want 1 : blah var1 var2 recordno a 1 2 1 b 3 2 2 c 3 3 3 d 8 4 4 Want 2: blah var1 var2 recordno e 5 6 1 f 7 2 2 g 3 1 3 h 9 4 4 and so on. How can I do this ? I know there must be use of a do loop. I'm just not figuring out how to do so. Thank you
... View more