BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
m1986MM
Obsidian | Level 7

Hello everyone,

I have two datasets which has the same variable (Uni_Id). I want to create a subset of dataset1 such that the new subset will contain the observations whose uni_id values are equal to the values for this variable in the other dataset, dataset2.

I appreciate any suggestion.

1 ACCEPTED SOLUTION

Accepted Solutions
GreggB
Pyrite | Level 9

Do  you want to keep the vars in both data sets?  I will assume  you do.  If you want only those observations where the ID is the same in both datasets:

proc sql;

create table join1 as

select a.*, b.* from dataset1 as a

inner join dataset2 as b

on a.Uni_id=b.Uni_id

quit:

You will get a warning saying that Uni_id appears in both data sets and it will the value of Uni_id in dataset1

View solution in original post

2 REPLIES 2
GreggB
Pyrite | Level 9

Do  you want to keep the vars in both data sets?  I will assume  you do.  If you want only those observations where the ID is the same in both datasets:

proc sql;

create table join1 as

select a.*, b.* from dataset1 as a

inner join dataset2 as b

on a.Uni_id=b.Uni_id

quit:

You will get a warning saying that Uni_id appears in both data sets and it will the value of Uni_id in dataset1

m1986MM
Obsidian | Level 7

Thank you.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 773 views
  • 0 likes
  • 2 in conversation