Help using Base SAS procedures

Merging 2 datasets

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 114
Accepted Solution

Merging 2 datasets

I have 2 data sets thst are same one has historical data and the one is daily
Table a
Code. Date. Dollar. Recommend
123. 03/212018. 1. 500
123. 03/21/2018. 2. 300
123. 03/21/2018. 100. 200

Table b
Dnd. date.max Dollar. Max Amt max
123. 01/01/2018. 1. 600
123. 12/01/2017. 2. 500


What I need the tables to merge Ive data step set thst merges but the dollar amt doesn't match max dollar
It only matches dnd to dnd.


Accepted Solutions
Solution
‎04-02-2018 03:03 PM
Super User
Posts: 13,566

Re: Merging 2 datasets


@Gil_ wrote:


What I need the tables to merge Ive data step set thst merges but the dollar amt doesn't match max dollar
It only matches dnd to dnd.


Show the code you attempted and the actual desired result for your example data.

 

I suspect that your dates play some role in the attempted merge but you will have to state what that would be.

View solution in original post


All Replies
Super User
Posts: 23,754

Re: Merging 2 datasets

What are you expecting as output?

Solution
‎04-02-2018 03:03 PM
Super User
Posts: 13,566

Re: Merging 2 datasets


@Gil_ wrote:


What I need the tables to merge Ive data step set thst merges but the dollar amt doesn't match max dollar
It only matches dnd to dnd.


Show the code you attempted and the actual desired result for your example data.

 

I suspect that your dates play some role in the attempted merge but you will have to state what that would be.

Frequent Contributor
Posts: 114

Re: Merging 2 datasets

Here how I want data merge
Code. Date. Dollar. Reco dnd mdate. Dol amt
123. 03/212018. 1. 500. 123 01/01/2018. 1. 600
123. 03/21/2018. 2. 300 123 12/01/2018 2. 500
123. 03/21/2018. 100. 200
Super User
Posts: 5,884

Re: Merging 2 datasets

And the code tried...?
Data never sleeps
Frequent Contributor
Posts: 114

Re: Merging 2 datasets

I tried
Data tablec;
Merge tablea tableb;
By dnd;
Run;
Frequent Contributor
Posts: 114

Re: Merging 2 datasets

Did sort by dnd b4
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 251 views
  • 0 likes
  • 4 in conversation