You can use LAG function, but it could be used only for previouse rows, so for your rows number 2.
Let say variables are: X1 X2 X3 X4
But because you can't do it for pairs, I suggest you to create one order variable and double use lag function. One for calculation one for copying the results.
Simple code, sorry striaght from the head, so it may not work 100% ok
Code: Select all
sort cases by nr (d).
if (mod(nr,2)=1) diff1=lag(diff1).
sort cases by nr (a).