I have two dataset similar to the examples below, both datasets have different variables. i wanted to read only observations (IDs) that are in both data.
Dataset one Dataset twoID A B ID C D10 1 2 10 0 420 3 4 30 5 230 5 6 40 7 3
I want the output that looks like this
ID A B C D 10 1 2 0 4
30 5 6 5 2
data want; merge one(in=in1) two(in=in2); by id; if in1 and in2; run;
In the future, please provide data as SAS data step code, so we can actually use it to test the code we provide. This helps all of us out, and gets you faster and more likely correct answers. Here are the instructions: https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/. Do not provide the data in other forms.
View solution in original post
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Register now!
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.