I want to merge two data sets on the basis of company name and year. The two data sets have same company name and same number of years but different variables. Can anyone here help me?
1. Sort by variables you'll be merging on
2. Merge via data step or SQL
Before you do, consider what type of merge you want. Is this a one to one match - each record in table 1 has an exat match in table 2?
Or do you want all records from one table? What if there's no match?
The documentation is very helpful in walking you through a merge and multiple different types of combining data. Here's the link to the Match Merge docs.
proc sort data=data1; by company_name year;
proc sort data=data2; by company_name year;
data want;
merge data1 data2;
by company_name year;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.