BookmarkSubscribeRSS Feed
Aerianna9
Fluorite | Level 6

Hello all, 

 

I am trying to complete an assignment for one of my courses and the goal of this assignment is to implement the library(caret) into SAS Studio and insert the following code: 

 

intrain- createDataPartition(YOURDATA$Churn,p=0.7,list=FALSE)
set.seed(2017)
training- YOURDATA[intrain,]
testing- YOURDATA[-intrain,]

 

However, when I copy and paste this code, I get the message "Error: object 'entrain' not found" and "Error: object 'training' not found". The same error continues for the assignments of training and testing. Any help would be appreciated at this point. Thank you!

4 REPLIES 4
Kurt_Bremser
Super User

@Aerianna9 wrote:

Hello all, 

 

I am trying to complete an assignment for one of my courses and the goal of this assignment is to implement the library(caret) into SAS Studio and insert the following code: 

 

intrain- createDataPartition(YOURDATA$Churn,p=0.7,list=FALSE)
set.seed(2017)
training- YOURDATA[intrain,]
testing- YOURDATA[-intrain,]

 

However, when I copy and paste this code, I get the message "Error: object 'entrain' not found" and "Error: object 'training' not found". The same error continues for the assignments of training and testing. Any help would be appreciated at this point. Thank you!


That does not look like Base SAS code (which you can run in SAS Studio).

Could it be that this is the internal code of a Miner project?

Aerianna9
Fluorite | Level 6
I'm not exactly sure. I have very little experience w/ SAS Studio and my professor seems to think that this can be done. It does enter in to SAS Studio without any issue, other than not being able to recognize the object, which results in the error the I described.
Cynthia_sas
SAS Super FREQ
Hi:
createDataPartition seems to be an R statement/command. I think that you may need to ask your professor or teaching assistant for a bit more direction. You can use R code in SAS/IML, in SAS Enterprise Miner and in SAS Studio with SAS Viya, but the method of using the R code will vary depending on which of these SAS components you are using.

Cynthia
Aerianna9
Fluorite | Level 6
Thank you, I will definitely ask. He recommended using SAS, which I was very confused by.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 830 views
  • 0 likes
  • 3 in conversation