When merging datasets, be sure the same variable names are not used

Whe merging data A and B and if A and B has variables that happen to have the same variable name, one of them will be deleted. For example, if A has "GPA" meaning individual-level GPA and if B has GPA meaning school-level GPA, one of them will be deleted after the merge.

data A;
gpa=1.2;
run;

data B;
gpa=999;
run;

data both;
merge A B;
run;

proc print;
run;

RESULT:
Obs gpa
1 999

Leave a Reply