<?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: Run regressions with combinations of multiple variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228289#M54267</link>
    <description>&lt;P&gt;Sounds like you want to select 5 variables for your model. If you want the selection to be based on r-square, adjusted r-square or Mallows CP then &lt;STRONG&gt;proc reg&lt;/STRONG&gt; can do the search for you. Something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc reg data=myData;
model x0 = x1-x20 / selection=CP start=5 stop=5 best=100;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will find the 100 best 5-variable linear models according to the CP criteria.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Oct 2015 21:17:04 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2015-10-02T21:17:04Z</dc:date>
    <item>
      <title>Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228277#M54262</link>
      <description>&lt;P&gt;I have 20 variables in the same data file. I need to try to run regressions with var0 being the dependent variable, and the independent variables being any five variables out of the rest 19 variables. Is there any quick way to run all the possible regressions in this case?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2015 19:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228277#M54262</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2015-10-02T19:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228279#M54263</link>
      <description>&lt;P&gt;I suppose you could write a macro to do this, but that doesn't sound like a trivial thing to do; and anyway, using Partial Least Squares regression (PROC PLS) ought to produce superior results (lower mean squared error for coefficients and predicted values) than using PROC REG as you are trying to do.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2015 20:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228279#M54263</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-02T20:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228289#M54267</link>
      <description>&lt;P&gt;Sounds like you want to select 5 variables for your model. If you want the selection to be based on r-square, adjusted r-square or Mallows CP then &lt;STRONG&gt;proc reg&lt;/STRONG&gt; can do the search for you. Something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc reg data=myData;
model x0 = x1-x20 / selection=CP start=5 stop=5 best=100;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will find the 100 best 5-variable linear models according to the CP criteria.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2015 21:17:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228289#M54267</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-02T21:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228323#M54270</link>
      <description>&lt;P&gt;Okay, that works, but I still think this is a poor choice of analysis.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2015 15:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228323#M54270</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-03T15:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228327#M54271</link>
      <description>&lt;P&gt;Agreed, statistical procedures for variable selection should never be used blindly. Simulations and sensitivity analyses have shown their instability over and over.&lt;/P&gt;
&lt;P&gt;On model selection issues, read &lt;A href="http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_glmselect_details14.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_glmselect_details14.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2015 17:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228327#M54271</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-03T17:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228332#M54272</link>
      <description>&lt;P&gt;I'm sorry if I am sounding like a cantakerous old model builder, I agree that the problems using variable selection techniques are well documented, and I agree that you shouldn't use these procedures blindly, but the original problem as stated tries to use these problematic model building procedures blindly with silly and meaningless restrictions (model can have only five variables).&lt;/P&gt;</description>
      <pubDate>Sat, 03 Oct 2015 18:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/228332#M54272</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-03T18:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229560#M54404</link>
      <description>&lt;P&gt;I tend to write a macro to do this because I have to utimately run Vector Autoregression (proc varmax), but don't really know how to start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lizi&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 16:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229560#M54404</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2015-10-12T16:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229585#M54405</link>
      <description>&lt;P&gt;Hi.&amp;nbsp; New situation,&amp;nbsp;six variables, VAR1 is dependent.&amp;nbsp; How many regressions taking VAR2-VAR6 three variables at a time ... 10 combinations ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var2 var3 var4&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var2 var3 var5&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var2 var3 var6&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var2 var4 var5&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var2 var4 var6&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var2 var5 var6&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var3 var4 var5&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var3 var4 var6&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;var3 var5 var6&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Given your 19 variables taken 5 at a time, that's 11,628 regressions.&amp;nbsp; You can write a macro (no problem, see below), but do you really want to " &lt;EM&gt;... run all the possible regressions ...&lt;/EM&gt; " ?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* generate all combinations of 5 vars taken 3 at a time;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data vars (keep=v1-v3);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;array v(2:6) $4 ('var2' 'var3' 'var4' 'var5' 'var6');&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;ncomb=comb(5,3);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;do j=1 to ncomb;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; call lexcomb(j, 3, of v(*));&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; put (v1-v3) ($5.);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; output;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;end; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* macro variable with total number of combinations, 5 vars taken 3 at a time;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;call symputx('regs',ncomb);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;* read combination, run regeression;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;%macro reg;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;%do j=1 %to &amp;amp;regs;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;data _null_;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; rec=&amp;amp;j;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; set vars point=rec;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; call symput('indpt',catx(' ',of v1-v3));&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&amp;nbsp; stop;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;proc reg data=x;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;model var1 = &amp;amp;indpt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;quit;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;%end;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;%mend;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2015 20:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229585#M54405</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2015-10-12T20:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229691#M54416</link>
      <description>&lt;P&gt;I want to nominate&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller﻿&lt;/a&gt;'s response for the Hall of Fame, if we had one. &amp;nbsp;To quote John Tukey twice:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no point in being precise when you don't know what you're talking about.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The combination of some data and an aching desire for an answer does not&amp;nbsp;ensure that a reasonable answer can be extracted from a given body of data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 13:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229691#M54416</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2015-10-13T13:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229738#M54422</link>
      <description>&lt;P&gt;Thanks a lot, Mike!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know it's unsual to "run all possible regressions", but this will allow me to exclude those with higher forecast errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;Lizi&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 16:04:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229738#M54422</guid>
      <dc:creator>lizzy28</dc:creator>
      <dc:date>2015-10-13T16:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with combinations of multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229748#M54423</link>
      <description>&lt;P&gt;Just because something can be programmed, it doesn't mean that it produces a good result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In particular, the models that wind up with higher forecast errors may be due to lots of reasons, including multi-collinearity among the X-variables, and in any event &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats﻿&lt;/a&gt; has provided a link that explains why this type of model selection is misleading at best, and should be avoided "because it violates every principle of statistical estimation and hypothesis testing".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'll say it again, your restriction of having exactly 5 independent variables in the model is silly and meaningless and most likely misleading; and again I recommend PROC PLS on all 19 independent variables.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 16:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Run-regressions-with-combinations-of-multiple-variables/m-p/229748#M54423</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2015-10-13T16:56:38Z</dc:date>
    </item>
  </channel>
</rss>

