How to convert years into relative years in spss?

#1
I sort my data according to ID in ascending order and then according to year in descending order. firm years with the same ID belong to the same firm. Imagine a firm has got 5 year observations, 2009, 2007, 2006, 2005, 2004. I would like to transform them into a new variable called relative years: 0, -2, -3, -4, -5.

I know how to do this in excel. But it took me considerable time even in a very small test sample. I was wondering whether this is achievable in SPSS. Thanks very much!
Tim
 

Karabiner

TS Contributor
#5
Use AGGREGATE with firm as breaking variable, and
thereby create a new variable containing a firm's lowest
value for "year". Use this variable to compute relative year.

Or, after sorting by firm and year (descending order),
use the LAG function.

With kind regards

K.