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;
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 16. 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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: