BookmarkSubscribeRSS Feed
clq
Calcite | Level 5 clq
Calcite | Level 5

Does a merge statement need a by statement? If not, then when do we use a by statement with the merge statement? 

3 REPLIES 3
SASKiwi
PROC Star

Read the documentation first: https://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=n1i8w2bwu1fn5kn1gpxj18xttbb0.htm&doc...

 

And if it is still not clear, then ask further questions. 

Cynthia_sas
Diamond | Level 26
Hi:
And in this previous forum posting: https://communities.sas.com/t5/SAS-Programming/Merge-datasets/td-p/463569 are some images and code to explain merge with BY.
Cynthia
Reeza
Super User

In addition, the documentation has a section that outlines the different way to combine data sets all side by side with code examples. 

http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n1xc1y8c37apw7n1erbi...

 

It's definitely worth a read.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1235 views
  • 0 likes
  • 4 in conversation