data temp;
input a b;
new = lag1(b);/*for Question 1*/
flag = int((_n_+1)/2);/* For Question 2*/
cards;
1 3
2 5
4 2
5 6
1 7
9 6
;
run;
data Q1(keep = c d);
set temp;
c = a;
d = b;
if mod(_n_,2) ge 1 then output;
run;
proc sql;
create table Q2 as select
max(a) as c from temp group by flag;
quit;