Run this:
data Test1;
input name $ number;
datalines;
Alex 301
Tor 78
Seine 200
Ron 450
Alex 301
;
data Test2;
input name $ number;
datalines;
Ran 65
Tor 78
Alex 209
Manik 34
Tor 44
;
proc sort data=test1;
by name;
run;
proc sort data=test2;
by name;
run;
data
match
nomatch
miss_1
miss_2
;
merge
test1 (in=t1 rename=(number=number1))
test2 (in=t2 rename=(number=number2))
;
by name;
if t1 and t2
then do;
if number1 = number2
then output match;
else output nomatch;
end;
else if t2
then output miss_1;
else output miss_2;
run;
and see if the results are what you need, otherwise tell us what you need to be different.
Please provide some sample data.
And given this data, what does your desired result look like?
Run this:
data Test1;
input name $ number;
datalines;
Alex 301
Tor 78
Seine 200
Ron 450
Alex 301
;
data Test2;
input name $ number;
datalines;
Ran 65
Tor 78
Alex 209
Manik 34
Tor 44
;
proc sort data=test1;
by name;
run;
proc sort data=test2;
by name;
run;
data
match
nomatch
miss_1
miss_2
;
merge
test1 (in=t1 rename=(number=number1))
test2 (in=t2 rename=(number=number2))
;
by name;
if t1 and t2
then do;
if number1 = number2
then output match;
else output nomatch;
end;
else if t2
then output miss_1;
else output miss_2;
run;
and see if the results are what you need, otherwise tell us what you need to be different.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.