0

I have two data sets (dataset1 and dataset2) with a different amount of rows. My goal is to match a column from dataset1 with another column from dataset2 and include three different columns from dataset2 that correspond with the matching column and insert it into datset1. Essentially the same thing as index matching in excel.

Sample code:

dataset1

COL1      COL2         COL3     COL4    
Nick      Grad          23       PSU 
Steve     Undergrad     22       FSU
Brit      Grad          24       OSU

dataset2    
COLA        Income
Brit        50,000
Mike        34,000
Steve       75,000
Ryan        45,000
Nick        55,000

I want to merge it so that it looks like this:

dataset3

COLA      Income     COL2         Col3      COL4
Brit      50,000     Grad          24        OSU
Mike      34,000     N/A           N/A       N/A
Steve     75,000     Undergrad     22        FSU
Ryan      45,000     N/A           N/A       N/A
Nick      55,000     Grad          23        PSU

Any help would be great, thanks!

Jaap
  • 81,064
  • 34
  • 182
  • 193
Nick
  • 833
  • 2
  • 8
  • 11

0 Answers0