SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  Compute cases in long format database

    Posted Mon February 21, 2022 04:09 PM
    I would like to do a longitudinal data analysis. For this I collected questionnaires from 300 patients on 4 different time points (so 4 questionnaires per patient). Not all patients have all 4 of these time points because, for example, they dropped out of the study early. This results in me having a database in a long format. In principle, there should therefore be 4 lines per patient (1 per questionnaire moment). But that's not because not everyone has had all 4 moments. So one patient has 4 lines and the other 3 ect. Is it possible to use a syntax or so to ensure that all missing lines per patients are added per patient? So that all patients have 4 rules in the database, 1 rule for each study visit. Them I can code the ones that are not filled in as missing

    ------------------------------
    Lotte Bakkerus
    ------------------------------

    #SPSSStatistics


  • 2.  RE: Compute cases in long format database

    Posted Tue February 22, 2022 03:45 PM
    Edited by System Admin Fri January 20, 2023 04:17 PM
    Hi, Lotte;

    Sorry for the delay in getting back to you.

    I want to be clear what your data structure is. From the description I think I know; this is simply to confirm.

    Overall, you have 300 subjects measured at 4 time points (there will be missing data). You are measuring change over time, so your hypothesis has a "within-subjects" component.

    The question I have is, how are your data structured in the data file? Are they like this (call it 'Case 1'):

    Subject 001 Time 1  Time2  Time 3  Time 4
    Subject 002 Time 1  Time2  <missing> <missing>
    ...
    Subject 300 Time 1  Time2  Time 3  Time 4

    so that 1 record (one line of data) = one subject, or this (call it 'Case 2'):

    Subject 001 Time 1
    Subject 001 Time 2
    Subject 001 Time 3
    Subject 001 Time 4
    Subject 002 Time 1
    Subject 002 Time 2
    Subject 003 Time 1
    ...
    Subject 300 Time 4
     
    where one line of data is a subject at one time, so there are as many records for a subject as there are returned questionnaires?

    It sounds like Case 2 is what you have. If you want to "join" all the data for a case into a single record, you can do that using the CASESTOVARS procedure. It will put missing values where there are no data from any given line. You just need to have a variable that is the Subject ID, which is the same for as many records as there for that observation. You can find help for that in the Command Syntax Reference. In the menus, look for Data > Restructure...

    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------