Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on September 10, 2024 5:07PM
Likes: 0
Replies: 3
Hello,
I would like to increment the number of rows group by some variables only when a condition between a date and its lag is true. The idea is the following :
if it is the first time we encounter an id, then var = 1;
else if id = id_lag and dat - dat_lag > 30 then var = var +1 ;
I try to do this with a window recipe but I can't. Can you help me please ?
Please attach a small sample dataset and how you want the output column to look like.
Sorry, I didn't attached my example :
my group variables : code_reg and id
var = 2 in line 4 and 7 because the difference between dat_evnm and dat_evnm_lag > 30
Can you please attach an actual Excel file? I can't load rows from an image…