-1

I want to split by large dataset randomly into two new dataset in the ratio of 70% - 30%.

Basically I need to allocate 70% of random values from large dataset to the newdataset1 and 30% of the random values from largedataset to the newdataset2.

Can you please help with a SAS code that will help me achieve it.

A dummy code will really help..

Proc SQl or SAS statement. Anything will work with me.

newbie49
  • 1
  • 2

1 Answers1

0

For complex sample design (like stratified randomization, e. g.) PROC SURVEYSELECT is a way to go, as @Keith said. But for just a simple random splitting RANTBL-function will do the trick:

  data newdataset1 newdataset2;
    set have;
    flag=rantbl(-1, 0.7, 0.3);
    if flag=1 then output newdataset1;
    else output newdataset2;
  run;
Dmitry Shopin
  • 1,753
  • 10
  • 11