Toggle navigation
Home
▼ Details
Products and pricing
Chart gallery
User stories
Text analytics
CDC NAMCS Library
Blog
Tutorials
Contact
Sign in
Post Editor
← All help posts
View post
Save
There are two types of data merging. One is to combine different datasets by appending more rows, and the other is [joining data to merge in new variables](/process-data/tbd-csv-left-join). The example code in this tutorial appends rows of data from multiple surveys vertically, resulting in a larger combined dataset. This is also referred to as "stacked" data. This method is suitable when the surveys use the same data column names for the same questions (e.g. different waves of the same study). New questions are fine, so long as the data column name is not the same as an old question from a previous wave. ## Add data tables Before creating a data process, add [date tables](https://help.protobi.com/adminaccess/project-data#New%20data%20table-0) and upload files for each dataset. <img src="/uploads/upload/image/5200/direct/1595874284328-1595874284328.png" alt="Protobi Data tables interface panel with blue header. Shows instruction text about creating data tables for CSV/SAV uploads. Contains blue button '+ New data table' at top, followed by four blue buttons labeled 'wave1', 'wave2', 'wave3', and 'wave4' representing existing data tables." style="width: 323px;" class="fr-fic fr-dib"> ## Data process code Declare a variable for each data table that will be combined (e.g. var W1,) and assign a value by referring to the respective data table name (e.g. data\[“wave1”\]). Enter the variables in the Protobi.stack\_rows function array. Add the return rows statement to recall the result of the stacking process. ``` var W1 = data["wave1"] var W2 = data["wave2"] var W3 = data["wave3"] var W4 = data["wave4"] var rows = Protobi.stack_rows([W1 ,W2, W3, W4]); return rows; ``` **Reminder**: For data processes, "Save" and "Run" the process after you are done editing the code view. To use the result of the process as the primary data for the project, you will need to set it as "Primary". *Data processes are specific to each project, and your code may not look identical to our example.*
Publishing
Date
Status
Published
Draft
Slug
edit
Content
Thumbnail
Categories
Manage
New to Protobi?
Charts
Making Changes
Intermediate topics for editors
Frequently Asked Questions
SERMO Topics
Tutorial Pages
Internal Docs
Data Processing
Videos
Obsolete
GSG Admin
SERMO Admin
GSG Topics
How to...
Basics for viewers
Basics for editors
For project admins
Advanced topics
Assessments
Articles (in-progress)
New and updated articles
Process data in Protobi
superseded
Text open-end questions
Troubleshooting
Tracking studies
Organizing the view
API References
Tools
AI Database
Checking AI...
Convert to MD
Danger zone
Delete