BookmarkSubscribeRSS Feed
mariko5797
Pyrite | Level 9

Suppose my datasets are organized like so:

mariko5797_0-1627065540572.png

I want to combine the information from dataset 1 and dataset 2 such that my columns are DISEASE, BMIGRP, COUNT_A, and COUNT_B.

I don't want to lose any information. That is, I want to maintain all the DISEASES granted they exist in at least one of the datasets like so:

mariko5797_1-1627065764454.png

 

Is there an efficient way to achieve this? Thank you in advance.

 

 

1 REPLY 1
Tom
Super User Tom
Super User

Just the MERGE statement.

Just make sure the data sets are sorted first. They do not appear sorted in your photographs.

data want;
  merge dataset1 dateset2;
  by disease bmigrp;
run;

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1148 views
  • 0 likes
  • 2 in conversation