How to split the data into three randoms sets: 60% in a building set, %10 in a test set and 30% in a validation set.
You can use the GROUPS= option in proc surveyselect. You must provide the exact set sizes of calculate them like this:
proc sql;
select
round(0.6*count(*)) as n1,
round(0.1*count(*)) as n2,
count(*) - calculated n1 - calculated n2 as n3
into :n1, :n2, :n3
from sashelp.class;
quit;
proc surveyselect data=sashelp.class groups=(&n1 &n2 &n3) out=samples;
run;
You can use the GROUPS= option in proc surveyselect. You must provide the exact set sizes of calculate them like this:
proc sql;
select
round(0.6*count(*)) as n1,
round(0.1*count(*)) as n2,
count(*) - calculated n1 - calculated n2 as n3
into :n1, :n2, :n3
from sashelp.class;
quit;
proc surveyselect data=sashelp.class groups=(&n1 &n2 &n3) out=samples;
run;
data train validate test;
set sashelp.heart;
call streaminit(123456789);
x=rand('table',0.6,0.3,0.1);
if x=1 then output train;
else if x=2 then output validate;
else output test;
drop x;
run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.