<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Drawing a decision tree from HPSPLIT in Mathematical Optimization, Discrete-Event Simulation, and OR</title>
    <link>https://communities.sas.com/t5/Mathematical-Optimization/Drawing-a-decision-tree-from-HPSPLIT/m-p/232817#M1153</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc hpsplit data=sashelp.cars;
target origin / level=nominal;
input msrp cylinders length wheelbase mpg_city mpg_highway invoice weight horsepower / level=interval;
input enginesize / level=ordinal;
input drivetrain type / level=nominal;
output nodestats=nstat;
run;

proc sql;
create view treedata as
select a.parent as activity, a.id as node, b.splitvar, b.predictedvalue
from nstat a, nstat b
where a.parent=b.id
union
select c.id as activity, . as node, c.splitvar, c.predictedvalue
from nstat c;
quit;

data treedata1;
set treedata;
select(predictedvalue);
when ('ASIA') _pattern=1;
when ('EUROPE') _pattern=2;
otherwise _pattern=3;
end;
run;

pattern1  c=green; pattern2 v=s c=red;  pattern3 v=s c=blue; 
footnote   c=green   'Asia  '  c=red     'Europe '    c=blue    'USA'; 
proc netdraw data=treedata1 graphics; 
     actnet /activity=activity successor=NODE  id=(splitvar) tree compress rotate rotatetext arrowhead=0 htext=5; 
run;
footnote ' ';&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Starting in EM14.1, I beleive, PROC HPSPLIT will produce it's own plots&lt;/P&gt;</description>
    <pubDate>Tue, 03 Nov 2015 15:47:26 GMT</pubDate>
    <dc:creator>FriedEgg</dc:creator>
    <dc:date>2015-11-03T15:47:26Z</dc:date>
    <item>
      <title>Drawing a decision tree from HPSPLIT</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Drawing-a-decision-tree-from-HPSPLIT/m-p/232799#M1152</link>
      <description>&lt;P&gt;Hello, I am looking for example code showing how to create a graphical representation of a decision tree produced with HPSPLIT. I've obtained a graph with &lt;STRONG&gt;proc tree&lt;/STRONG&gt; where I put all information in the leaves but I would prefer the layout provided by &lt;STRONG&gt;proc netdraw&lt;/STRONG&gt; or &lt;STRONG&gt;proc dtree&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 20:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Drawing-a-decision-tree-from-HPSPLIT/m-p/232799#M1152</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-02T20:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a decision tree from HPSPLIT</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Drawing-a-decision-tree-from-HPSPLIT/m-p/232817#M1153</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc hpsplit data=sashelp.cars;
target origin / level=nominal;
input msrp cylinders length wheelbase mpg_city mpg_highway invoice weight horsepower / level=interval;
input enginesize / level=ordinal;
input drivetrain type / level=nominal;
output nodestats=nstat;
run;

proc sql;
create view treedata as
select a.parent as activity, a.id as node, b.splitvar, b.predictedvalue
from nstat a, nstat b
where a.parent=b.id
union
select c.id as activity, . as node, c.splitvar, c.predictedvalue
from nstat c;
quit;

data treedata1;
set treedata;
select(predictedvalue);
when ('ASIA') _pattern=1;
when ('EUROPE') _pattern=2;
otherwise _pattern=3;
end;
run;

pattern1  c=green; pattern2 v=s c=red;  pattern3 v=s c=blue; 
footnote   c=green   'Asia  '  c=red     'Europe '    c=blue    'USA'; 
proc netdraw data=treedata1 graphics; 
     actnet /activity=activity successor=NODE  id=(splitvar) tree compress rotate rotatetext arrowhead=0 htext=5; 
run;
footnote ' ';&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Starting in EM14.1, I beleive, PROC HPSPLIT will produce it's own plots&lt;/P&gt;</description>
      <pubDate>Tue, 03 Nov 2015 15:47:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Drawing-a-decision-tree-from-HPSPLIT/m-p/232817#M1153</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2015-11-03T15:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a decision tree from HPSPLIT</title>
      <link>https://communities.sas.com/t5/Mathematical-Optimization/Drawing-a-decision-tree-from-HPSPLIT/m-p/232824#M1154</link>
      <description>&lt;P&gt;Thanks Matt! That gives me a very good start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: I had to replace &lt;EM&gt;act1&lt;/EM&gt; by &lt;EM&gt;Activity&lt;/EM&gt; in the last step.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 22:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Mathematical-Optimization/Drawing-a-decision-tree-from-HPSPLIT/m-p/232824#M1154</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-02T22:52:59Z</dc:date>
    </item>
  </channel>
</rss>

