Tuesday, January 4, 2011

LAG function

LAG Function (SAS 9.2 Doc)

*** Use a third variable to assign the value from the previous record;

array one a b c d;
array two e f g h;
      do over one;
            temp = lag(one);
            if first.id = 0 and last.id=1 and two = . then do;
                  two = temp;
            end;
      end;

1 comment:

Unknown said...

It was very nice article and it is very useful to SAS OC learners.We also provide Cub training software online training.