From the course: SAS Programming for R Users, Part 1
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Match-merging data sets - SAS Tutorial
From the course: SAS Programming for R Users, Part 1
Match-merging data sets
- [Narrator] Now the merge statement is much more powerful than the way I've previously detailed. Instead of just doing a straight C-bind, we can actually merge according to a common variable in each data set. And in the next few examples I'll show you how to do a one-to-one, one-to-many-, and non-match merge. To actually do the following match merging, you have to first go ahead and sort your data by that common variable. And to do so you'll just use Proc Sort. That's a really easy procedure which you can go ahead and look up on the online doc page in your own time. Once you go ahead and use the sort procedure, then you can use your data step and use the merge statement. And you'll list all the data tables you want to merge according to some common variable. And to tell SAS what that common variable is, you'll list it in the by statement. So imagine I have a data set called employees and a data set called phone, which obviously holds the names of my employees and the phone numbers…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Creating new variables and conditional processing5m 38s
-
Conditionally creating variables with a DO group2m 53s
-
Using SAS functions4m 12s
-
Using SAS functions on character data4m 37s
-
Demo: SAS function documentation2m 2s
-
Creating functions for the DATA step5m 20s
-
Subsetting data3m 38s
-
Concatenating data sets2m 18s
-
Match-merging data sets2m 41s
-