proc sql;
create table want as
select FirmID, Year, Variable1 as Variable1_2
from
(select * from have1
union all
select * from have2)
order by firmid,year;
quit;
data want ;
set have1(rename=(variable1=variable1_2))
have2(rename=(variable2=variable1_2))
;
run;
If the data was already sorted by FIRMID YEAR you can add a BY statement and the result will still be sorted.
data want ;
set have1(rename=(variable1=variable1_2))
have2(rename=(variable2=variable1_2))
;
by firmid year ;
run;
Register Today!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.