DATA Step, Macro, Functions and more

Matching on a non-unique variable ?

Accepted Solution Solved
Reply
Super Contributor
Posts: 286
Accepted Solution

Matching on a non-unique variable ?

Nomatch contains the list of students who have no access_code nor a link. I put in a request for these students and received a file named Extra_codes that has a code and a link for each student. The access_code is unique but the link is unique only to the school. 

 

I want to "transfer" the access_code and link from Extra_codes to Nomatch.    (a copy/paste, if you will).

 

The n count of school in Nomatch is the same as the n count of schoolname in Extra_codes.

 

My 2 data sets:

 

Nomatch

school        last         first        access_code link

east high    able        hotel      

east high    baker      india      

west elem  charlie    juliet       

west elem  delta       kilo        

north mid    echo      lima

north mid    foxtrot    mike

north mid    golf        nove

 

Extra_Codes

schoolname     access_code        link

east high           22                        https://lovesas.com/43

east high           17                        https://lovesas.com/43

west elem          77                        https://lovesas.com/55

west elem          80                        https://lovesas.com/55

north mid           89                        https://lovesas.com/98

north mid           03                        https://lovesas.com/98

north mid            20                       https://lovesas.com/98


Accepted Solutions
Solution
‎04-25-2018 03:45 PM
Super User
Posts: 13,283

Re: Matching on a non-unique variable ?

if the count does match and the order of the data is as you need then this might be as simple as

 

data want;

   merge nomatch extra_codes;

run;

 

Though if the code value of 22 is supposed to go with baker india instead of able hotel then more details needed.

View solution in original post


All Replies
Solution
‎04-25-2018 03:45 PM
Super User
Posts: 13,283

Re: Matching on a non-unique variable ?

if the count does match and the order of the data is as you need then this might be as simple as

 

data want;

   merge nomatch extra_codes;

run;

 

Though if the code value of 22 is supposed to go with baker india instead of able hotel then more details needed.

Super Contributor
Posts: 286

Re: Matching on a non-unique variable ?

thanks. all that matters is that baker and able get codes that belong to east high.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 104 views
  • 0 likes
  • 2 in conversation