Help using Base SAS procedures

Ranuni( ) to Unevenly Split File

Reply
Regular Contributor
Posts: 173

Ranuni( ) to Unevenly Split File

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';
Regular Contributor
Posts: 173

Re: Ranuni( ) to Unevenly Split File

I have resolved this issue.
Thanks.
Ask a Question
Discussion stats
  • 1 reply
  • 152 views
  • 0 likes
  • 1 in conversation