BookmarkSubscribeRSS Feed
matt23
Quartz | Level 8

What is the easiest way to take around 80% and data and test it against the rest 20%? I'm using regression and want to find the best model and RMSE and R-squared and AIC etc. are very close. And by easiest I mean as for someone new to SAS.

 

Or Am I should I just pick the lowest RMSE or the best model from the SELECTION option? I have over 80,000 observations and the numbers are really close

1 REPLY 1
PaigeMiller
Diamond | Level 26

a simple way to generate a validation data set and a training data set with 20/80 split

 

data rand;
    set have;
    random=ranuni(0);
run;
data train_plus_validate;
    set rand;
    original_y=y;
    if rand>0.8 then y=.;
run;
proc reg data=train_plus_validate;
    model y=x1 x2 x3;
    output out=predicteds p=predicted;
run;
    

By setting y to missing in the validation data set, these observations are not used in creating the regression model, but you do get predicted values for each of them (that's what PROC REG does if the y is missing); you can then see how close the predicted values are to variable ORIGINAL_Y.

--
Paige Miller

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!

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