BookmarkSubscribeRSS Feed
CathyVI
Pyrite | Level 9

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
Pyrite | Level 9

@Reeza  Thank you, it worked.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 648 views
  • 2 likes
  • 2 in conversation