When creating a database of variables in a longitudinal study, there is often a question of how to format the data.
Each row can be a person and for every new time he or she is tested a new variable is created (wide format):
Or, a new row can be started for each new time point measured (long format):
Some types of analyses require the wide format and others require the long format. One particular problem people run into is how to convert one format to the other. In SPSS, SAS, Stata, and JMP, the procedure is relatively simple (simple once you have figured it out). In SPSS, the following syntax will turn the wide formatted file into a long formatted file (see pictures; of minor note, this syntax file would not actually work because of the length of my variable names. However, substituting your 8 character variable names into this syntax will work just fine.):
/make Depression from DepressionWeek1 DepressionWeek2
/make Anxiety from AnxietyWeek1 AnxietyWeek2
/index = Week.
To convert this long formatted file back to wide formatting, the following SPSS code can be used:
In JMP, the transpose, sort, and stack options can get the desired results.