Skip to content

Instantly share code, notes, and snippets.

@abhishekdagarit
Last active September 27, 2017 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishekdagarit/ed7feeb51c4e56e160981a2077c9a8ca to your computer and use it in GitHub Desktop.
Save abhishekdagarit/ed7feeb51c4e56e160981a2077c9a8ca to your computer and use it in GitHub Desktop.
Merging datasets in SAS

Merging datasets in SAS

The process is straight forward.

Data 1

data d1;
input name$ age;
datalines;
ak 12
bk 32
ck 22
;
run;

Data 2

data d2;
input name$ sex$;
datalines;
ak 'm'
bk 'f'
ck 'm'
;
run;

Merging datasets: Simply use merge ______ by

data combined_data;
merge d1 d2;
by name;
run;

Print statement

proc print data=combined_data;
run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment