BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I need help.

Who can help me unlock this mystery?


I have a set of data with 1,000 records. There are various columns such as Transaction Date, Customer ID, Age, Town, Zip Code, Country, etc. Of the 1,000 customers that I get every month, about 8% to 10% pay with credit cards.

If I pull a subset of my dataset using a certain age range AND certain zip codes AND a few other things together, I get fewer records e.g. 80 records, with 40 of them being those who buy on credit. With this subset, the percentage credit card customers becomes 50% of the subset.

When I use the same specifications (age range, those same zip codes, etc.) the next month, the subset becomes about 100 with 35 credit card customers. The percentage in this case is 35%

My interest is to pull a subset that has 50% credit card customers, and I don't mind much about what criteria is used. I don't care about how many customers are produced in the subset. I just want that 50% composition. My question is, what SAS/SQL language/clause/function/etc can I use in a code to produce a SUBSET that has 50% credit card customers?

Thanks
2 REPLIES 2
ArtC
Rhodochrosite | Level 12
Do a search on random subsets. There are a number of possible solutions. Look at PROC SURVEYSELECT first.
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Mack,

Do you have an atribute indicating that a customer is a credit card customer? If yes then it is very simple. Please, explain your point.

Sincerely,
SPR

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1190 views
  • 0 likes
  • 3 in conversation