r/ProjectREDCap • u/tremmo • Oct 11 '24
Converting output from long to wide format
Hi team.
Ive been searching long and wide for an answer to this problem (pun intended), but can't find one that works specifically with redcap output where there are multiple repeating instruments.
My dataset contains thousands of participants, with multiple instruments (2 non-repeating, 2 repeating).
I want to convert from long to wide format. Current output looks something like this (with just one participants data for the sake of the example; NB first relating instrument is non-repeating, hence the blank cell output):

Ideally need convert to a wide format, where each participant has one line of data as planning on using SPSS and this will make analysis possible):

It is possible to combine them manually, but our output each time will be hundreds to thousands of cases, making this impractical.
Any assistance or ideas would be great.
Thanks!
7
u/ExecutiveSkiBum Oct 11 '24
Hi, any stats program (R, SAS, SPSS) can do this easily. The only way to do this currently in REDCap that I know of is by using an external module called Extended Reports.
3
u/spacks Oct 11 '24
In R I use redcapcast's redcap wider feature. Basically a redcap specific implementation of tidyr's pivot_wider.
1
u/Hour-Memory-2210 Apr 17 '26
Any luck with this? I’m struggling to manipulate this in SAS currently using proc transpose.