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

G2 Grid Leader Spring 2025.png

 

 

 

 

Want to review SAS Customer Intelligence 360? Gartner and G2 are offering a gift card or charitable donation for each accepted review. Use this link for G2 to opt out of receiving anything of value for your review.

 

Gartner.jpg

 

SAS Customer Intelligence 360

Get started with CI 360

Review CI 360 Release Notes

Open a Technical Support case

Suggest software enhancements

Assess your marketing efforts with a free tool

 

Training Resources

SAS Customer Intelligence Learning Subscription (login required)

Access free tutorials

Refer to documentation

Latest hot fixes

Compatibility notice re: SAS 9.4M8 (TS1M8) or later

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.

G2 Grid Leader Spring 2025.png

 

 

 

 

Want to review SAS Customer Intelligence 360? Gartner and G2 are offering a gift card or charitable donation for each accepted review. Use this link for G2 to opt out of receiving anything of value for your review.

 

Gartner.jpg

 

SAS Customer Intelligence 360

Get started with CI 360

Review CI 360 Release Notes

Open a Technical Support case

Suggest software enhancements

Assess your marketing efforts with a free tool

 

Training Resources

SAS Customer Intelligence Learning Subscription (login required)

Access free tutorials

Refer to documentation

Latest hot fixes

Compatibility notice re: SAS 9.4M8 (TS1M8) or later

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