<?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: Can I use proc hpsplit with weighted data? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Can-I-use-proc-hpsplit-with-weighted-data/m-p/921995#M83368</link>
    <description>&lt;P&gt;HPSplit supports a WEIGHT statement.&lt;/P&gt;
&lt;PRE&gt;proc hpsplit data=sorted_data seed=12345  maxdepth=3;
   class target;
   model target = var1 var2 var3 ; 
   output out=out_tree ;
   weight FINALWGT_LP; 
run;&lt;/PRE&gt;
&lt;P&gt;If the weight variable is missing or non-positive (negative or zero) the observation will be excluded from the model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have no idea where CHAGGPT gets its rules from but it seems to have lots of problems with SAS syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check your online help for the procedure under Syntax to find basic options.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Mar 2024 16:04:38 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-03-27T16:04:38Z</dc:date>
    <item>
      <title>Can I use proc hpsplit with weighted data?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-I-use-proc-hpsplit-with-weighted-data/m-p/921987#M83367</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to build a decision tree using proc hpsplit. My dataset has 13,000 observations and data are weighted, so I need to take the weights into account. Is it possible to add &lt;FONT color="#0000FF"&gt;weight&lt;/FONT&gt; statement in proc hpsplit? I used ChatGPT to generate a potential SAS code and resulted in:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&lt;STRONG&gt;&lt;FONT color="#000080"&gt;proc hpsplit&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000FF"&gt;data&lt;/FONT&gt;=sorted_data seed=&lt;STRONG&gt;&lt;FONT color="#008080"&gt;12345&lt;/FONT&gt; &lt;FONT color="#008000"&gt;method=tree(splitrule=gini)&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000FF"&gt;maxdepth&lt;/FONT&gt;=3;
   &lt;FONT color="#FF0000"&gt;class&lt;/FONT&gt; target;
   &lt;FONT color="#FF0000"&gt;model&lt;/FONT&gt; target = var1 var2 var3 &lt;STRONG&gt;&lt;FONT color="#008000"&gt;/ weight=FINALWGT_LP; &lt;/FONT&gt;&lt;/STRONG&gt;
   &lt;FONT color="#0000FF"&gt;output&lt;/FONT&gt; out=out_tree &lt;STRONG&gt;&lt;FONT color="#008000"&gt;predicted=predicted_prob&lt;/FONT&gt; &lt;FONT color="#008000"&gt;predlevel=predicted_level&lt;/FONT&gt;&lt;/STRONG&gt;;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I ran this code, I got syntax error messages for the text&lt;STRONG&gt;&lt;FONT color="#008000"&gt; in green&lt;/FONT&gt;&lt;/STRONG&gt;.&amp;nbsp; However, after modifying the SAS code and removing all text &lt;STRONG&gt;&lt;FONT color="#008000"&gt;in green&lt;/FONT&gt;&lt;/STRONG&gt;, I was able to produce a tree (not sure how correct it is, but seemed to work). Unfortunately, this updated code was not taking weights into account anymore.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I incorporate the &lt;FONT color="#0000FF"&gt;weight&lt;/FONT&gt; statement into proc hpsplit? OR is there another procedure better suited for decision trees taking into account data weights?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any guidance!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 15:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-I-use-proc-hpsplit-with-weighted-data/m-p/921987#M83367</guid>
      <dc:creator>Viani_P</dc:creator>
      <dc:date>2024-03-27T15:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use proc hpsplit with weighted data?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-I-use-proc-hpsplit-with-weighted-data/m-p/921995#M83368</link>
      <description>&lt;P&gt;HPSplit supports a WEIGHT statement.&lt;/P&gt;
&lt;PRE&gt;proc hpsplit data=sorted_data seed=12345  maxdepth=3;
   class target;
   model target = var1 var2 var3 ; 
   output out=out_tree ;
   weight FINALWGT_LP; 
run;&lt;/PRE&gt;
&lt;P&gt;If the weight variable is missing or non-positive (negative or zero) the observation will be excluded from the model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have no idea where CHAGGPT gets its rules from but it seems to have lots of problems with SAS syntax.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check your online help for the procedure under Syntax to find basic options.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 16:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-I-use-proc-hpsplit-with-weighted-data/m-p/921995#M83368</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-03-27T16:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use proc hpsplit with weighted data?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Can-I-use-proc-hpsplit-with-weighted-data/m-p/922028#M83370</link>
      <description>&lt;P&gt;thank you so much! this worked &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2024 18:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Can-I-use-proc-hpsplit-with-weighted-data/m-p/922028#M83370</guid>
      <dc:creator>Viani_P</dc:creator>
      <dc:date>2024-03-27T18:50:49Z</dc:date>
    </item>
  </channel>
</rss>

