I am currently working on a dataset in SAS like this:
people - word - date - rank
A - bla - 01/01/2017 - 1
A - bla - 02/01/2017 - 2
A - test - 03/01/2017 - 3
B - bla - 01/01/2017 - 1
B - test - 09/01/2017 - 2
C - bla - 03/01/2017 - 1
C - test - 05/01/2017 - 2
C - test - 07/01/2017 - 3
C - sas - 08/01/2017 - 4
And I would like to transform it like this :
people - word - rank
A -------- bla ----- 1
A -------- test ----- 2
B -------- bla ----- 1
B -------- test ----- 2
C -------- bla ----- 1
C -------- test ----- 2
C -------- sas ----- 3
The rank is in function of the date, group by people.
I tried to use the lag function, but also syntaxes with case when (it works but I have to do this for every case and I have a maximum rank of 94... Not really easy !)
So I did not find a great way to have the last table.
Can you help me ?
Thanks a lot