BookmarkSubscribeRSS Feed
nathilanga
Calcite | Level 5

Good day

 

I have a two dataset as shown below

 

dataset1 customer_name and sitecode (has 50000 observation unique on customer_name)

sam 2430

nice 3401

jim 2030

holl 3540

and so on

dataset2 sitecode and required_number_of_customer (this dataset show the site and number of customers required per site and not repeating and this dataset contains 800 observation all unique on site code)

2430 60

4020 10

3540 2000

and so on

 

the requirement is that i should create one dataset that is going to contain number of unique customers according to the observation required per site

if the customer is selected to site 2430 should not be included on other site 

also flag selected customers so they wont get selected on the next run

 

apologies i am new to SAS i currently dont have any code

Your help will be highly appreciated

 

thanks 

 

Regards

 

N

 

4 REPLIES 4
Onizuka
Pyrite | Level 9

I don't understand very well, what i understood is that you maybe need a merge.

 

Data dataset3 ;

MERGE dataset1 (in = A) dateset2 (in=B) ;

by sitecode ; if A and B ; run ;

Maybe something like that ?

nathilanga
Calcite | Level 5

Good day 

 

this is merging my goal out of lets say i have 200 site with and summed required customers for all sites 3000 and my base of customers is 10000 i should have 7000 flagged as not selected one more time

 

customerbase has below examples

customername sitecode

ben                  2430

get                  1000

sip                   2430

 

site dataset

sitecode            numberofcustomersrequiredpersite

2430                 10

1000                  8

 

all customer that should be under 2430 for an example in a base table they must be on site 2430  

ballardw
Super User

Some additional information seems likely to be needed.

Do you need to know the probability of selection or sample weight value for any of these selections?

What is the total number of the numbers of records to be selected per site code?

 

The example you provide for number of records needed averages over 350 per site. If that average is the same across all 800 site codes then that would mean that you need over 285000 records and that will not be possible from 50000 customer records.

 

Do you have any secondary rules you haven't mentioned such as if some sites may not be able to meet the goal without duplicating a customer which site the customer should be assigned to?

 

nathilanga
Calcite | Level 5

good day

 

one line item I didnt mention is below 

all customer that should be under 2430 for an example in a base table they must be on site 2430

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 869 views
  • 0 likes
  • 3 in conversation