BookmarkSubscribeRSS Feed
yaoyao
Fluorite | Level 6

I'd like to build a tree model with cross-validation. I'd like to assign observations to different cross-validation groups by myself instead of random sampling. I am not sure how SAS can do this. It would be helpful if anybody can share some example SAS code. 

 

Many thanks in advance

1 REPLY 1
yaoyao
Fluorite | Level 6

Just add some details about my question. I have monthly time-series data. And I want to predict forward 3 months. So there are some overlapping periods when running cross-validation. For example, if Jan and Feb are in the training set and March in the testing set, the model might know what is likely to happen when using the training set due to the overlapped periods. Currently, I run sampling before building the tree model and assign group id for cross-validation. For example, assign Jan, Feb, and Mar as group 1 and Jun and Jul as group 2. Pass the group ID to the tree model function. I implement it in R. Not sure how SAS can do it.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 674 views
  • 0 likes
  • 1 in conversation