BookmarkSubscribeRSS Feed
pmbrown
Quartz | Level 8

regarding the following Q:

 

This project will use data set cert.input08a and cert.input08b. ... Both data sets contain a common numeric variable named ID. Write a program that will use a SAS DATA Step to:
◦ Combine data sets cert.input08a and cert.input08b by matching values of the ID variable.

the answer is given as:

proc sort data=cert.input08a out=work.input08a;
by ID;
run;
proc sort data=cert.input08b out=work.input08b;
by ID;
run;
data results.match08 results.nomatch08 (drop=ex: );
merge work.input08a (in=a) work.input08b (in=b);
by ID;
if a and b then output results.match08;
else output results.nomatch08;
run;

but this would lead to a note in the log: 'merge statement has more than one data set with repeats of BY variables'

for this reason i would use nodupkey on the sort and it feels to me that the Q is urging a mistake from the programmer - they should be very worried about this note and such a log would not be regarded as 'clean'. Am i right?

1 REPLY 1
Mark2010
SAS Employee

@pmbrown You are right. We will need to clean up the input data sets to dedup the ID variables. 

Welcome to the Certification Community

 

This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:

Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers

 

Why Get SAS Certified.jpg

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1114 views
  • 1 like
  • 2 in conversation