I have a dataset which, in some cases, contains data of a particular score from multiple time points "score1" and "score2". So I want to create a new variable "prospective"=1 which identifies the cases with prospective data (same "id" and with "score1" and "score2" data available). Thus, it should look something like this:
Therefore, if the "id" is the same but the score is missing in one of the different time points, it should return "prospective"=0. I have tried using the LAG function, something like this:
DO IF (id = LAG(id)) AND ((Score1 GE 0) OR (Score2 GE 0)) AND ((LAG(Score1) GE 0) OR (LAG(Score2) GE 0)).
Compute LAG(Prospective = 1) AND Prospective =1.
END IF.
Execute.
However, I get an error saying that an equal sign was not found when expected after a target variable in a COMPUTE command.
I would really appreciate it if you could help me. Thank you!

The following code will count the valid values in each row for every ID, then aggregate the count across both rows of the ID. Then ID's with a count of two valid values will be marked as prospective=1 (the others - 0):