BookmarkSubscribeRSS Feed
MeredithG
Calcite | Level 5

I'm having a hard time understanding how to take my dataset of 6000 observations and randomize them to 3 unequal groups (1000, 1000, and 4000), and then randomize each of those into 5 equal groups (so 15 groups total). There are no strata, I only need to split the observations randomly into three unequal groups, then each of those into to five equal groups. The only variable in the dataset is ID number. I'm trying to do this with PROC SURVEYSELECT and PROC PLAN and having no luck.

2 REPLIES 2
Reeza
Super User

Can always do it the old fashion way, with creating a random number:

data want;

    do ID=1 to 6000;

        ran_number=rand('normal');

        output;

    end;

run;

proc sort data=want;

by ran_number;

run;

data want2;

    set want;

    if 1 <= _n_ <=1000 then group=1;

    else if 1001 <= _n_ <=2000 then group=2;

    else group=3;

run;

MeredithG
Calcite | Level 5

Okay, yes, that makes sense. Then I can take each of the 3 groups and do the same thing to randomize them to 5 equal groups. Thank you!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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