This is the code I have written. It consists of 3 Data Steps. The first 2 work perfectly, but the last doesn't do anything and I can't work out why. Any help would be very much appreciated
data A.OCT_DEDUPE_LEVEL1;
set A.OCT_NOMANLOGOFFERR;
by ID_INTERNET level1 notsorted;
if first.level1 then journey=1;
run;
As expected the above step works through my data and creates a flag, set to 1 for each first instance of level1. The next step then works through my data and groups it into 'sessions'
data A.OCT_SESSIONISE;
SET A.OCT_DEDUPE_LEVEL1;
IF level1 = 'Step1' and journey = 1 then session+1;
run;
This final step (below) should then work through the data again and ensure that every last thing in each session is also given a flag of journey = 1. What happens is nothing though and for the last step in each the journey field is left null.
data A.OCT_DEDUPE_SESSION;
set A.OCT_SESSIONISE;
if last.session then journey=1;
run;
Any ideas what is going on anyone?
Thanks in advance