BookmarkSubscribeRSS Feed
KevinC_
Fluorite | Level 6
Hello everyone,

I am using ranuni( ) to split my input file 50/50 into two letter_types: hybrid letter & example letter. Then I use a field called 'LTV' to calculate the offer_pct for the output.

In the output, I want the 'hybrid' letter_type to have one more offer_pct (0%) than the 'example' letter_type. When I use ranuni( ) this causes the 'hybrid' letter_type to have more than 50% of the original population.

How can I have one more 'offer_pct' entry in the 'hybrid' letter_type and still maintain a 50/50 split between the two letter_types?


This is how I want the output distribution to look:

offer_pct letter_type
0% NonResponder hybrid letter
4% NonResponder hybrid letter
8% NonResponder hybrid letter
18% NonResponder hybrid letter
4% NonResponder Example letter
8% NonResponder Example letter
18% NonResponder Example letter

Here is my code:

r1 = ranuni(1234);
if ltv >= 120 then offer_pct='4%';
else if 110 <= ltv < 120 then offer_pct='8%';
else if 95 <= ltv < 110 then offer_pct='18%';
else offer_pct = '0%';

if r1 < .5 then letter_type = 'hybrid';
else if r1 >= .5 then letter_type = 'example';
1 REPLY 1
KevinC_
Fluorite | Level 6
I have resolved this issue.
Thanks.

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

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
  • 1 reply
  • 1077 views
  • 0 likes
  • 1 in conversation