Please reformat that example and probably better to place in a text box.
You can use data set options to rename the variables that should align
Data want; set one two (rename=(r=x s=y)) ; run;
for example renames the R to X and S to Y if that is the way you want them aligned (not stated). HOWEVER when you do this it is up to you make sure that the variable types are the same in both sets.
This rename is one of the data set options can be used anywhere, not just in a data step set statement. Other options can drop or keep variables, subset data and create a number of sometimes useful temporary variables.
One option is to use a SQL Union ALL. The variable names in the combined data set will have the names as per the first select statement.
data have1;
input x y;
cards;
1 2
3 4
5 6
;
data have2;
input r s;
cards;
5 6
7 8
9 0
;
proc sql;
create table combined as
select x, y
from have1
union all
select r, s
from have2
;
quit;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.