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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1319 views
  • 0 likes
  • 4 in conversation