How to merge longitudinal survey files by participant ID
A practical workflow for combining baseline and follow-up files without quietly adding participants or overwriting repeated measurements.
Start with the file that defines who belongs in the study
Suppose you have roster.csv, baseline.csv, week4.csv, and week8.csv. Before you think about columns, decide which file should define the participant list. In many studies that is the roster; in others it may be a carefully maintained baseline file. In Research Data Merger, that file becomes the base table, so its participant IDs define the final rows.
Check the ID column before you merge anything
The same participant can appear as P004 in one file and P0004 in another. A source may also contain a duplicate ID or a test record that never belonged in the roster. Review those cases first. A merge is much easier to trust when you know exactly which IDs matched, which were cleaned up, and which were left unmatched.
Treat follow-up columns as new measurements, not replacements
If Baseline and Week 4 both contain Score, Q1, and Q2, those values are usually not conflicts. They are measurements from different timepoints. Keep them side by side with labels such as Score_Baseline and Score_Week4 instead of overwriting one set with the other.
Before analysis, read the merge record once
Check the final row count, any source-only IDs, duplicate handling, and the labels used for repeated measurements. This takes a minute and gives you a record of the choices that produced the final dataset.
A small example
roster.csv: P001 P002 P003 baseline.csv: P001 P002 P003 week4.csv: P001 P002 P003 P999 Wide result: ID | Score_Baseline | Score_Week4 P001 | 72 | 78 P999 is reported as source-only; it is not silently added.
Using this workflow in Research Data Merger
Choose the participant-defining base table, review ID mismatches and duplicates, label repeated measurements by visit, and export the merge record with the finished dataset.