I have two datasets and I'm trying to merge them like it would be done if I were using a lef join approach on SQL.
I've created this code:
Data final_dataset;
merge table_1 (in=a) table_2;
if a=1;
keep Var1 Var2 Var3 Var4 Var5;
run;
The problem is that in both datasets I have variables with the same name. For example, Var1 and Var2 are both in table_1 and table_2 but I want that the merged data has only the variables Var1 and Var2 from table_1. How can I do that?
If it were a proc sql the code would be something like that:
proc sql;
create table final_dataset
as select
A.Var1 A.Var2 B.Var3 B.Var4 B.Var5
from table_1 as A left join table_2 as B
on A.Var1 = B.Var1;
But I am trying to learn SAS language and I want to know if there is a way to do what I want in this language.