BookmarkSubscribeRSS Feed
Kolmashekidim
Calcite | Level 5

I'm a SAS beginner facing what seems to be an advanced question not addressed in the Enterprise Guide. Two datasets A and B both contain the same ID field.  Dataset B has a Region field.  Each ID in dataset B has a unique Region.  I want to extract all the records in dataset A which have Region = 1 in dataset B.  (Or Region = whatever value I choose.)  Is there something obvious I am overlooking?

Or equally useful, I suppose, would be an approach to add the Region field to dataset A based on its values in Dataset B.

1 REPLY 1
PGStats
Opal | Level 21

To create a new dataset with all fields from A plus the Region you could use:

proc sql;

create table C as

select A.*, B.region

from A left join B on A.id=B.id;

quit;

PG

PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 582 views
  • 0 likes
  • 2 in conversation