Good morning,
Dataset A which contains 10,000 observations and 700 variables;
Dataset B, which contains 2,000 observations and 10 variables.
Both A and B have the same three columns, including ID column. All the 2,000 IDs of dataset B are from dataset A. The IDs in both A and B datasets are non-duplicated. Dataset B has some updated information if the same columns are in both datasets.
I would like to merge two datasets. The final dataset C should contain 10,000 observations and 707 variables with updated information of dataset B, including the 7 new columns from B too. Please help me to approach this procedure, thank you.
Your situation is pretty straight forward.
Your question would have solution in the books (The little SAS Book, Learning SAS by Example) and various articles.
This is a must have https://documentation.sas.com/api/docsets/basess/9.4/content/basess.pdf (Chapter 16)
One example is https://www.lexjansen.com/nesug/nesug11/ds/ds03.pdf
Please revert back when you have issues.
One important suggestion : start with a small dataset of 20 -30 observations.
Sample datasets in the books will help.
Once you are through apply to the complete datasets.
What does this statement mean?
Dataset B has some updated information if the same columns are in both datasets.
Does that mean that some of the NON KEY variables in the two datasets are the same?
If so and both A and B have unique observations per by group then a simple MERGE will replace the values read from A with the values read from B.
But if A has repeating observations for the same by group then a simple merge will not work.
Please provide a detailed example of your situation using as few observations and variables as possible.
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.