BookmarkSubscribeRSS Feed
Siddhartha
Calcite | Level 5
Hi,

I have a Dataset A with the following

ID SID CID IID INM

A1 0 1 001 X
A1 0 2 002 X
A1 0 4 004 X
A1 0 3 003 X

I have another Dataset B with the following

ID SID CID

A1 421 4
A1 422 4
A1 121 1
A1 122 1
A1 123 1
A1 321 3
A1 221 2

I want to merge the Dataset A and Dataset B by CID and get the following output and the output order should be in the order of Dataset A.Look at the following output

ID SID CID IID INM

A1 121 1 001 X
A1 122 1 001 X
A1 123 1 001 X
A1 221 2 002 X
A1 421 4 004 X
A1 422 4 004 X
A1 321 3 003 X

Can anyone help me in getting the above output using merge statement in SAS.


Regards,
Siddhartha
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
This is not an ODS or Base Reporting (PRINT, REPORT or TABULATE) question. The documentation on the MERGE statement is quite thorough and there are a lot of user-group papers on the topic of MERGING and JOINing tables together.

Or, for specific help with your data, you might consider contacting Tech Support.

cynthia

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 609 views
  • 0 likes
  • 2 in conversation