BookmarkSubscribeRSS Feed
CathyVI
Lapis Lazuli | Level 10

In the SAS learning course Programming 2, the rand function was used with “Integer” for random values to the data but when I tried it using my SAS 9.4 TS level 1M3 on Microsoft windows 10 enterprise(x64), I couldn’t get the same result. I also looked online to see compatible distribution for the Rand function but non specify the “integer”. This is my data step;

 

data test.class1;

NameID=Rand("Integer", 100,999);

set test.Class;

drop name sex;

run;

 

I have also tried the (RandBetween), but didn’t work. Any help ?

2 REPLIES 2
Reeza
Super User
Rand with the INTEGER option was introduced in SAS 9.4 - which is about 7 years old now. It's not available in SAS 9.3. Instead you can roll your own using Uniform distribution or using a macro written by Rick Wicklin here:
https://blogs.sas.com/content/iml/2015/10/05/random-integers-sas.html
CathyVI
Lapis Lazuli | Level 10

@Reeza  Thank you, it worked.

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 1193 views
  • 2 likes
  • 2 in conversation