Help using Base SAS procedures

Join two datasets

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 114
Accepted Solution

Join two datasets

I have 2 data sets I need to combine here is 1st one
Number date id total
123. 12/01/17. 1. 30
345. 05/07/17. 10. 60
453. 06/17/17. 20. 90
323. 06/23/17. 50. 50
2nd table .
Number. 2 Date.2 id total 2
123. 03/07/18. 1. 50
345. 03/07/18. 10 100
453 03/07/18. 20 60
323. 07/07/18. 50 80
I want to see
Number. Date. Id. Order. Order2
123. 12/01/17. 1. 30. 50
345. 05/07/17. 5 60. 100
453. 06/17/17. 10 90. 60
323. 06/23/17. 50. 50. 80
When I do a join the number to number the id number is out of sequence where 1 is match up to 20.



Accepted Solutions
Highlighted
Solution
‎03-13-2018 04:59 PM
Super User
Posts: 13,523

Re: Join two datasets


Gil_ wrote:

When I do a join the number to number the id number is out of sequence where 1 is match up to 20.



Show the code you used. And "where 1 is match up to 20" doesn't make much sense in terms of what you have shown.

 

Provide example data in the form of data steps if you want tested code. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

View solution in original post


All Replies
Highlighted
Solution
‎03-13-2018 04:59 PM
Super User
Posts: 13,523

Re: Join two datasets


Gil_ wrote:

When I do a join the number to number the id number is out of sequence where 1 is match up to 20.



Show the code you used. And "where 1 is match up to 20" doesn't make much sense in terms of what you have shown.

 

Provide example data in the form of data steps if you want tested code. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

☑ This topic is solved.

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

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