1

I would like to structure my long format SPSS file so I can clean it and get a better overview. However, I run into some problems.

Patients appear several times in the database (Column patientID). How can I make a new variable that contains only 1 patient ID preferable on the line with baseline data/first moment that questionnaires are completed?

enter image description here

I have consulted with my colleagues, but without concrete solutions/answers

eli-k
  • 10,898
  • 11
  • 40
  • 44
Anne
  • 11
  • 2

1 Answers1

0

This can be done using the lag function - after sorting the file:

sort cases by PatientID_Pseudo OpenInvulMomenten.
if $casenum=1 or ($casenum>1 and PatientID_Pseudo<>lag(PatientID_Pseudo)) newvar=PatientID_Pseudo.
exe.
eli-k
  • 10,898
  • 11
  • 40
  • 44