BookmarkSubscribeRSS Feed
animesh123
Obsidian | Level 7
Id amt Id amt2

1 1000 1 100
1 2000 1 200
1 3000. 2 300
2 4000. 2 400
2 5000. 2 500

What will be the output if we use various type of Data merge statement?
6 REPLIES 6
Astounding
PROC Star

In a DATA step, the MERGE statement combines two or more SAS data sets.  You have only shown one SAS data set.  So you will need to show more about what you are trying to do ... what should the other data set look like?  What would you like the result to be.

ballardw
Super User

Is that two data sets? Note really a very clear example.

 

Are you referring to a Data step Merge statement?

If so, you might get better results in showing what you want from them instead of "what can you get" because things like data set options can change variable names or drop variables.

 

Sorts that occur before the Merge can have a lot of impact on the result.

Match merge with BY variable(s) often do not behave as expected or desired when the by variables have multiple values it two or more data sets.

 

Kurt_Bremser
Super User

@animesh123 wrote:
Id amt Id amt2

1 1000 1 100
1 2000 1 200
1 3000. 2 300
2 4000. 2 400
2 5000. 2 500

What will be the output if we use various type of Data merge statement?

Since you want to use "various" types without giving further details, all I can say is that you'll get equally various outputs.

 

Also see Maxim 42.

animesh123
Obsidian | Level 7
A. B
Id1 amt1 Id2 amt2

1 1000 1 100
1 2000 1 200
1 3000. 2 300
2 4000. 2 400
2 5000. 2 500

What will be the various types of output if we merge ID1(a) and ID2 (b)

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
  • 6 replies
  • 498 views
  • 0 likes
  • 5 in conversation