Hi guys,
I have 2 datasets with one common value, let's call that value 'source'.
set 1
source file
1 A12
1 Ddd55
56 C566
57 D684
so one source can have multiple files (source is not a unique column), l
let's assume the max files per source is 3.
each file is unique.
set 2
source code
1 A
1 B
1 C
56 D
56 E
56 F
57 G
57 H
57 I
so in this dataset there are 3 codes for each source. all these codes are unique.
I need to assign a code from dataset 2 to each source in dataset 1,
keeping the unique character (so 1 code per file).
so the result would have to be something like:
source file code
1 A12 A
1 Ddd55 B
56 C566 D
57 D684 G
I'm breaking my head because I believe the solution will probably be very simple???
data want;
merge set1(in=a) set2;
by source;
if a;
run;
data want;
merge set1(in=a) set2;
by source;
if a;
run;
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.