The problem could be solved by using data-step merge without by ... why don't you want to use merge?
proc sort data=a out=a_sorted(keep=Age) nodupkey;
by Age;
run;
proc sort data=b out=b_sorted(keep=Age) nodupkey;
by Age;
run;
proc sort data=c out=c_sorted(keep=Age) nodupkey;
by Age;
run;
data compare;
merge
a_sorted(rename=(Age = Age_A))
b_sorted(rename=(Age = Age_B))
c_sorted(rename=(Age = Age_C))
;
run;
Would the desired result be a list of distinct values per data set or the list of distinct values over all data sets?
The problem could be solved by using data-step merge without by ... why don't you want to use merge?
proc sort data=a out=a_sorted(keep=Age) nodupkey;
by Age;
run;
proc sort data=b out=b_sorted(keep=Age) nodupkey;
by Age;
run;
proc sort data=c out=c_sorted(keep=Age) nodupkey;
by Age;
run;
data compare;
merge
a_sorted(rename=(Age = Age_A))
b_sorted(rename=(Age = Age_B))
c_sorted(rename=(Age = Age_C))
;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.