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

I am attempting to create a random sample using proc sql. I found this article from the SAS website that uses the function RANUNI ( the following paper ) however when I try to run this I get an error saying RANUNI "is not a recognized build-in function name. "

 

Am I using it incorrectly or is there another function I can use for this?

 

here is my code using SAS EG to try and get a 10% sample:

 

proc sql;

connect to sqlsvrasfrprod(datasrc=frproduser=&uidpassword="&pawd" readbuff=3000);

create table sample as

select * from connection to frprod(

select distinct

a.startdate, a.notifydate, a.id, a.ctype, a.type, a.longdesc,

b.account,

c.ctypid

from comp.dbo.comp a

join comp.dbo.accounts b

on a.id=b.id

join comp.dbo.ban c

on left(b.account,6)=c.bannumber and ctypid between 2 and 5

where ranuni(1234) between .45 and .55;

);

quit;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Use a datastep?  Extract data from the database, then run a proc surveryselect over that to get your sample:

https://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_surveyselec...

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Use a datastep?  Extract data from the database, then run a proc surveryselect over that to get your sample:

https://support.sas.com/documentation/cdl/en/statug/63347/HTML/default/viewer.htm#statug_surveyselec...

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 1656 views
  • 3 likes
  • 2 in conversation