BeOptimized - Tips and Tricks

Merging data with DataStep

In this tips and tricks we will have a look to the merge statement of the SAS DataStep in order to combine datasets.


Combining data is very common in data manipulation, this allows you to get information contained in a table and to combine them with information contained in an another table. Your data can be combined horizontally (join, merge) or vertically (set, append) and this can be done in datastep or proc sql. This tips and tricks is focused on the merge statement .
Table of contents:

  • one to one merging
  • inner join + non-matching rows
  • one to many merging
  • many to many merging
  • update records with merge statement
  • create accumulated variable with sum statement
  • by group processing
  • aggregation in datastep
  • doing more with proc sort


You have some SAS experience and would like to join or append data sets in data step or SQL.

Go back to your selection

This site uses cookies. .

By continuing to browse the site you are agreeing to our use of cookies. Review our cookies information for more details.