hi..please find another example... DATA cars1; INPUT make $ model $ mpg weight price; CARDS; AMC Concord 22 2930 4099 AMC Pacer 17 3350 4749 AMC Spirit 22 2640 3799 Buick Century 20 3250 4816 Buick Electra 15 4080 7827 Cuick Electra 15 4080 7827 Cuick Century 20 3250 4816 Cuick Spirit 22 2640 3799 ; RUN; proc sql; create table test as select make,model,mpg,weight,price,monotonic() as rownum,max(calculated rownum) as max,min(calculated rownum) as min, case when calculated rownum=calculated max then 1 else 0 end as last_record, case when calculated rownum=calculated min then 1 else 0 end as first_record from cars1 group by make order by rownum ;quit;
... View more