For this question, I think it's a one-to-many merge. So I chose 3 as my answer. Can you please explain why the answer is 5? Thanks so much
You are correct that this is one-to-many.
The result of a one-to-many though usually reflects the number of records in the many.
This is small enough I suggest actually typing the code, though you might be able to copy and paste to your editor as I can't since you posted a picture, and run the code.
data agetable; input name $ age; datalines; Bob 12 Sue 15 ; data foodtable; input name $ food $; datalines; Bob Pizza Bob Cupcakes Bob Burgers Sue Grapes Sue Brownies ; data both; merge agetable foodtable ; by name; run;
You might also experiment with the way the result table looks if you change the order of the two sets on the Merge statement to verify that the same number of records results and what the order of variables in the data set might be.
You are correct that this is one-to-many.
The result of a one-to-many though usually reflects the number of records in the many.
This is small enough I suggest actually typing the code, though you might be able to copy and paste to your editor as I can't since you posted a picture, and run the code.
data agetable; input name $ age; datalines; Bob 12 Sue 15 ; data foodtable; input name $ food $; datalines; Bob Pizza Bob Cupcakes Bob Burgers Sue Grapes Sue Brownies ; data both; merge agetable foodtable ; by name; run;
You might also experiment with the way the result table looks if you change the order of the two sets on the Merge statement to verify that the same number of records results and what the order of variables in the data set might be.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.