Surveys can contain “loops” where a subset of the survey is repeated several times per respondent. This is typical in new product assessments, employee satisfaction surveys, patient case research, and observational trials.

You can choose whether to see survey loops “flattened” or “stacked”. Which is best depends on your analysis goals.

In this example, there’s a main section of the survey that each respondent completes once, plus a case report form that each respondent completes for each of three patients:

"Flatten" loops

Typically survey engines "flatten" the data for export. The data file contains one row per respondent and one column per question item. Multiple cases are represented by multiple data columns. In this illustration each square represents a cell in the data file. Flattening loops is best if they are to be considered independently. A flat data file makes it eash to show data for each question for each loop:

"Stack" loops

Another approach is to "stack" the cases vertically, so there is one row per respondent per loop. It is often useful to the merge the main respondent data with each loop, as shown by the grey cells. This allows correlation between respondent-level variables and loop-level variables: Stacking is best when the loops are similar, and should be pooled for analysis. Here's the same example showing the cases stacked with the loop index as a profile variable for analysis.

Loop data in SERMO

Protobi automatically recognizes loops in SERMO surveys. By default loops are flattened. Each loop is organized as an separate group, and included in a “pageable” tab. You can flip between cases by pressing the arrow keys.

Your SERMO project can optionally be setup to stack and merge data automatically instead.

Program stacking logic externally

You can program stacking logic yourself in R, SPSS or your favorite language. Just upload the new dataset and set that to be the primary dataset.

Program stacking in Protobi

Protobi has a rich language for data processing. A simple example of stacking data for three patient cases together is below:

Your study likely has more complexity and we can show you how to do it. The key thing is stacking code you might otherwise have your DP team write in R or SPSS can be done within Protobi, so your logic is all in one place, with version history, and can be run every time you upload new data.