Hello Ladies and Gentlemen,
I am trying to output a random number within a proc iml statement.
For example if i do: A=RANUNI(-1); any time it give a different random number between 0 and 1.
Now I have my interval (Bi, Bi+1) and I want a random number between this interval. Just like RANUNI(-1), I want this interval to change anytime I run it and to vary as I vary my interval
See the article How to generate random numbers in SAS - The DO Loop which shows how to use the RANDGEN routine to generate random numbers. If u is in the inerval [0,1] then Bi+u is in the interval you want. You can use CALL RANDSEED(0) if you want the random number stream to be different each time you run the program. Remember also that if you are going to need thousands of random numbers to vectorize the program by allocating an array and filling it: Efficient Sampling - The DO Loop
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.