I have a table like:
id date value new
x 01/01/2019 1
y 01/01/2019 2
x 01/02/2019 1
z 01/03/2019 1
I am trying to select where id=x,y
Then, once I have that subset, I want to check if x has a corresponding y of the same date - if it does, then I want to set new to value where y - for both x and y; otherwise, new is just set to value
so the table would become
id date value new
x 01/01/2019 1 2
y 01/01/2019 2 2
x 01/02/2019 1 1
z 01/03/2019 1 1
I am totally unsure how to go about this,
I began by subsetting my data:
IF id='x' OR id='y' THEN DO;
/*...*/
END;
ELSE new=value;
any help would be appreciated
Also, I cannot use the actual dates in my code