From the course: SAS Essential Training: 1 Descriptive Analysis for Healthcare Research

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Sorting and merging

Sorting and merging - SAS Tutorial

From the course: SAS Essential Training: 1 Descriptive Analysis for Healthcare Research

Start my 1-month free trial

Sorting and merging

- [Instructor] In this video I'm going to show you how to use SAS to sort and merge datasets. Those of you who use SQL might be more used to using the term joining datasets. I'm using the term merge here, because the actual command in SAS is merge, but merge and join essentially mean the same thing. In SAS, to merge datasets, you first need a common variable in both datasets. In our demonstration that's going to be the _STATE variable. Next, you sort each dataset by that variable separately. And then finally you use the merge command to merge them together. I wanted to make sure you were clear of the steps before showing you the code, because it gets a little long with all those steps in it. But now, let's turn to our SAS code. Here we are in SAS. I have opened the exercise file for this movie named 440_Merge. So here is our first dataset in the merge, BRFSS_a. I wanted to run a proc freq on the _STATE variable, which is the variable we will use for merging. Let's highlight and run…

Contents