BookmarkSubscribeRSS Feed
jbrau123
Obsidian | Level 7

Hello

 

I am using hpsplit for decision tree modeling and I can successfully get outputs including ROC curve. I have looked through the documentation for hpsplit but I can't seem to find info about how to export the x-y plot values to a table. I wish to export the values so that I can compare ROC curve from the decision tree to other ROC curves in one common plot. With CVMODELFIT I can get some fit values but not each of the x-y plot values, it seems. 

 

Best,

J

 

xy.png

 

https://support.sas.com/documentation/onlinedoc/stat/141/hpsplit.pdf

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Try ODS OUTPUT

 

ods output rocplot=rocplot;
--
Paige Miller
jbrau123
Obsidian | Level 7

Thank you very much! I got an error but that is probably just because I am not sure where to put it. I have "ods word close;" as the last line of my code but when I put it there, I get an error. 

 

DATA desicion; set work.farm;
PROC SORT; BY farm year;

Title 'Decision tree model';
ods graphics on;
ODS word file="farm_predict_decisiontree.docx";
proc hpsplit cvmodelfit seed=13289; /* hpsplit for tree-based statistical models. Seed is a pseudo-random number generator */
class milk_dummy2 farm year cows land labor;
model milk_dummy2 = farm year cows land labor;
grow entropy;
prune costcomplexity;

RUN;
ods output rocplot=rocplot word close;

 

ballardw
Super User

The ODS OUTPUT statement should be in the body of the procedure code or immediately preceding the Procedure. It is also a statement that requires a semicolon to end it.

 

proc hpsplit cvmodelfit seed=13289; /* hpsplit for tree-based statistical models. Seed is a pseudo-random number generator */
   class milk_dummy2 farm year cows land labor;
   model milk_dummy2 = farm year cows land labor;
   grow entropy;
   prune costcomplexity;
   ods output rocplot=rocplot ;
RUN;

Strongly suggest that you get in the habit of ending procedures with a RUN; statement and that that you use DATA= to tell procedures which data set to use. I know that SAS makes pretty good attempts to deal when they are not present but I've seen some interesting "why is that happening questions" when people get interrupted and the _last_ data set is not the one they intend to use for a procedure.

 

 

jbob2024
Calcite | Level 5

Ofcourse, yes, I should always end with a RUN statement, my apologies. Thank you very much for your help, it has been very helpful!

PaigeMiller
Diamond | Level 26

Thank you very much! I got an error but that is probably just because I am not sure where to put it. I have "ods word close;" as the last line of my code but when I put it there, I get an error. 

 

@jbrau123 COMMENT for your future benefit: had you included your PROC HPSPLIT code in your initial message, we wouldn't have had this issue, I would have shown you where to put the ODS OUTPUT statement. So, please, always, that's ALWAYS, show us the relevant part of your code, in this case all of your PROC HPSPLIT code, in your initial post. If the error occurs in a DATA step, show us the DATA step (all of it). If there are errors in the log, we will always (that's ALWAYS) need to see the log of that PROC or DATA step as well.

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 560 views
  • 0 likes
  • 4 in conversation