BookmarkSubscribeRSS Feed
jcis7
Pyrite | Level 9

G'day:

Appreciate any  help you can give.  How do you merge the two fields and retain both IDs.

Then, match based on a chosen ID between two files.

This question is Not Answered.

jcis7Newbie

Currently Being Moderated                   

Hello!  Any help you can give is appreciated!

I've DataFile1:

ID                  Type       Address             (other fields, etc...)

12345678      B             1 Aurora Ln                            

12345676      A             1 Aurora Ln                              

12345677      A             30 Chester Way                 

12345667      B             30 Chester Way                  

12345654      A             45 Picadilly Ln

12345432      B             45 Picadilly Ln           

How do you merge with the following

RESULT 1

IDA                    IDB                      Address                  (other fields, etc)

12345676         12345678             1 Aurora Lane

12345677         12345667             30 Chester Way

12345654         12345432             45 Picadilly Ln

I've another data file, Data File 2,  that has the ID listed for the Type B's from DataFile1 but for which I need to replace the ID listed from DataFile1 with the Type A ID.  The address for DataFile 2 may not be the same as the address for data file 1.

Data File 2 also has other IDs that are correct and therefore don't need updating.

Data File 2

ID                  Type       Address             (other fields, etc...)

---observations with the same ID listed in DataFile1 but may have updated information

12345678      B             1 Aurora Ln  #B                                                                     

12345667      B             305 Chester Wy                  

12345432      B             45 Picadilly Ln 

.....more observations that don't need the ID number changed

13456787      A             300 Westinghouse

14556764      B             134 Hemingway

How do you match RESULT 1 with Datafile 2 (i.e., match IDB from RESULT 1 to ID in DataFile 2) but then keep only IDA and he Updated Address from DataFile 2 to get the Final Table below

Need:  Final Table

ID                  Type       Address             (other fields, etc...)                       

12345676      A             1 Aurora Ln #B                               

12345677      A             305 Chester Way                               

12345654      A             45 Picadilly Ln

13456787      A             300 Westinghouse

14556764      B             134 Hemingway

Thank you!

1 REPLY 1
Fugue
Quartz | Level 8

Isn't this the same as https://communities.sas.com/thread/48311??

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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