<?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: Regression with a By variable in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/439763#M6747</link>
    <description>&lt;P&gt;Would SAS ever consider just allowing the user to define the variable role to be "BY" in the model variable editor?&amp;nbsp; Seems like that would be a way easier user experience.&amp;nbsp; Defining BY variables is so easy&amp;nbsp;in SAS EG, but&amp;nbsp;quite cumbersome&amp;nbsp;in SAS EM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm reading the start/end group documentation now, still haven't quite figured it out...&lt;/P&gt;</description>
    <pubDate>Fri, 23 Feb 2018 17:24:51 GMT</pubDate>
    <dc:creator>BrianRexing</dc:creator>
    <dc:date>2018-02-23T17:24:51Z</dc:date>
    <item>
      <title>Regression with a By variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/435679#M6712</link>
      <description>&lt;P&gt;PROC REG allows one to specify a BY variable generating a regression model and coefficients for each value of the BY-variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How does one achieve the same result in Enterprise Miner?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 16:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/435679#M6712</guid>
      <dc:creator>BrianLoe</dc:creator>
      <dc:date>2018-02-09T16:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with a By variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/436426#M6719</link>
      <description>&lt;P&gt;Hello BrianLoe-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Enterprise Miner, you can use the Start Groups / End Groups node pair to perform by-group processing.&amp;nbsp; Set the Mode property to Stratify.&amp;nbsp; For details from within Enterprise Miner, select Help -&amp;gt; Contents -&amp;gt; Node Reference -&amp;gt; Utility Nodes -&amp;gt; Start Groups Node.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not all modeling nodes produce the same output with group processing that they produce without group processing.&amp;nbsp; In the case of Start Groups -&amp;gt; Regression -&amp;gt; End Groups, you still need to perform some coding in order to see the parameter estimates at each iteration.&amp;nbsp; One method is to add a SAS Code node after the End Groups node.&amp;nbsp; Select the Code Editor property, and enter code like this (it assumes that this is a new diagram that contains only one Regression node):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;proc print data=&amp;amp;EM_LIB..reg_effects_loop;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Close the window, run the node, view the results.&amp;nbsp; The PROC PRINT output shows the coefficient value for each variable at each level of the BY group.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is an alternative approach that involves no coding.&amp;nbsp; The alternative works well if your BY variable has only a handful of levels.&amp;nbsp; With this approach, use one Filter node and one Regression node for every level of the BY variable.&amp;nbsp; In each level, use the Filter node to filter out the unwanted levels, and you get the usual Regression node results.&amp;nbsp; You can copy &amp;amp; paste the Filter / Regression pair, and manually modify each Filter node.&amp;nbsp; I.e., if your BY group has 5 levels, then you will have 5 Filter / Regression pairs that run in parallel.&amp;nbsp; Connect each Regression node to a single empty SAS Code node so that you can run everything from that single SAS Code node, if you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which approach to consider depends on the overall goal of your flow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a very large number of BY variable levels, then you might want to consider using SAS Factory Miner, a product that is designed for analyzing data that contains a large number of segments (BY variable levels).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your interest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 19:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/436426#M6719</guid>
      <dc:creator>MikeStockstill</dc:creator>
      <dc:date>2018-02-12T19:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with a By variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/439763#M6747</link>
      <description>&lt;P&gt;Would SAS ever consider just allowing the user to define the variable role to be "BY" in the model variable editor?&amp;nbsp; Seems like that would be a way easier user experience.&amp;nbsp; Defining BY variables is so easy&amp;nbsp;in SAS EG, but&amp;nbsp;quite cumbersome&amp;nbsp;in SAS EM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm reading the start/end group documentation now, still haven't quite figured it out...&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 17:24:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/439763#M6747</guid>
      <dc:creator>BrianRexing</dc:creator>
      <dc:date>2018-02-23T17:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with a By variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/439816#M6748</link>
      <description>&lt;P&gt;Hello&amp;nbsp;BrianRexing -&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BY-variable processing (using a BY statement on a procedure) is a special case of group processing, whereas Enterprise Miner has additional methods of group processing available.&amp;nbsp; For what you want, take these steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- Add a Start Groups node at the point where you want the group processing to begin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- Click the Variables property (or right-click the node and select Edit Variables).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- In the Variables window, change the Grouping Role value to Stratification for the variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; that you want to use to define your groups (your BY variable).&amp;nbsp; You can have more than one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Close the Variables window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- Change the Start Groups Mode property to Stratify.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Use the Stratify mode to perform standard group processing. When you use the Stratify mode, the Start&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;Groups node loops through each level of group variable when you run the process flow diagram. When&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;you select the Stratify mode, the Minimum Group Size and Target Group properties are enabled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- Add the nodes that you want to process repeatedly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;- Add an End Groups node to close the loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For an example, see Help -&amp;gt; Contents -&amp;gt; Node Reference -&amp;gt; Utility Nodes -&amp;gt; Start Groups Node -&amp;gt;&amp;nbsp;Start Groups Node Example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For details about all of the group processing modes that are available, see the&amp;nbsp;Start Groups Node Train Properties: General section of that same chapter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a nice weekend.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 19:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Regression-with-a-By-variable/m-p/439816#M6748</guid>
      <dc:creator>MikeStockstill</dc:creator>
      <dc:date>2018-02-23T19:51:47Z</dc:date>
    </item>
  </channel>
</rss>

