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
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 ?
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
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?
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
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.