Update current record with next record value

Ben_Entrew

Registered User.
Local time
Yesterday, 16:17
Joined
Dec 3, 2013
Messages
177
Hi all,

I want to identify the time frame of a agent's job.
For example Agent 081 had a task aaa from 202012-202104, then it switched to task vvv from 202104 until now 202102.

I found this code:

data want;
recno=_n_+1;
set Task_times end=last;
if not last


then set Task_times (keep=TIME_ID rename=(TIME_ID=TO)) point=recno;
else call missing(TO);
run;


The output looks like:

TIME_IDAgentA_typeFROMTO
202012​
081aaa
202012​
202104​
202104​
081vvv
202104​
202012​
202012​
082aaa
202012​
202102​
202102​
082vvv
202102​
202102​
202102​
083aaa
202102​
202112​
202112​
083vvv
202112​
202012​

It's not exactly what I want, I need to check also the Agents.

Does anyone know how I can add an additional condition checking wheter the Agent of the next row is the same or not?

Thank you.

Many greetings,
Ben
 
Last edited:
Many Thanks Arnelgp,

forgot to mention I'm trying this in SAS.
Somehow SELECT TOP 1 doesn't work out here.

Any clue how to adjust this?

Thanks.
 
sorry, no idea.
 

Users who are viewing this thread

Back
Top Bottom