BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ravindrrapaal
Obsidian | Level 7

Hello, I am facing some while implementing the RANUNI. Below is the definition of RAN UNI

 

FLOOR((MOD(<</Client/ID CUID>>*397204094,(2**31)-1)/((2**31)-1)+1)*1000000000000000)

the above string will generate 20 digit random number then i need to select 5th digit of this number basis on the result need to apply cases like 

 

WHEN 5th Digit <2 THEN 'CG'
WHEN 5th Digit ❤️ THEN 'D1'
WHEN 5th Digit <10 THEN 'D2'

 

I am struggling to be able to covert form numeric to char then char to numeric. where <</Client/ID CUID>> variable is numeric.

I am getting error most of the time 

like <<root.field367>> is invalid and can't be used in query

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Is there a reason you are not using the RAND function, which has excellent statistical properties and supports the Table distribution and the discrete uniform ("Integer") distribution?

 

Anyway, if X is the 20-digit number,

Compute Y by dividing X by 1E15, truncating to an integer, and then multiplying by 1E15.

Compute Z as X - Y. The first digit of the 15-digit number Z is what you want.

To get the first digit of Z, divide by 1E15 and truncate.

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Is there a reason you are not using the RAND function, which has excellent statistical properties and supports the Table distribution and the discrete uniform ("Integer") distribution?

 

Anyway, if X is the 20-digit number,

Compute Y by dividing X by 1E15, truncating to an integer, and then multiplying by 1E15.

Compute Z as X - Y. The first digit of the 15-digit number Z is what you want.

To get the first digit of Z, divide by 1E15 and truncate.

ravindrrapaal
Obsidian | Level 7
Thank you so much for your response. The solution worked
How to improve email deliverability

SAS' Peter Ansbacher shows you how to use the dashboard in SAS Customer Intelligence 360 for better results.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 478 views
  • 0 likes
  • 2 in conversation