Hi all,

I have a panel dataset on productivity. The variables are as follows:
activity = the activity/task an employee is doing (e.g. phone call, ACW (after call work), chat, administration).
week = week number

Basically, I need to drop the observations if activity is "ACW" when the previous activity was "Chat" in week 22 only.

The command i have so far is thus: drop if activity==ACW if week==22 & (the previous activity was "Chat")
Also, ACW has a value label of 3, so the real command will be: drop if activity==3 if week==22 & (the previous activity was "Chat")
Chat has a value of 7.

I tried everything, but I cannot find out the right command for the bold part. Can someone help me out?

Thank you in advance.