<?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: Building of Regression Model using all the possible combination of variable in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680413#M32726</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/342925"&gt;@pshankar&lt;/a&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you trying to accomplish here? Do you want to run all linear models for som variables and choose the best? Or something else? In either case, a macro is probably not the easiest way to go.&lt;/P&gt;</description>
    <pubDate>Mon, 31 Aug 2020 11:19:08 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-08-31T11:19:08Z</dc:date>
    <item>
      <title>Building of Regression Model using all the possible combination of variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680410#M32725</link>
      <description>&lt;P&gt;I am trying to build linear regression model for all the combination of variable. Ex: If y=c+x1+x2+x3, then I want to build model using the independent variable:&lt;/P&gt;&lt;P&gt;X1&lt;/P&gt;&lt;P&gt;X2&lt;/P&gt;&lt;P&gt;X3&lt;/P&gt;&lt;P&gt;X1 X2&lt;/P&gt;&lt;P&gt;X1 X3&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;X1 X2 X3.&lt;/P&gt;&lt;P&gt;I have written the code to generate all the possible combination of variable and now trying to pass each combination in the proc reg, But&amp;nbsp; &amp;nbsp;I am not able to do so. My aim is to automate the whole code in such a way that if i change the model input data the code automatically generate all the possible model.&lt;/P&gt;&lt;P&gt;Code I have done :&lt;/P&gt;&lt;P&gt;DATA model_data;&lt;BR /&gt;input y1 x1 x2 x3;&lt;BR /&gt;cards;&lt;BR /&gt;2 2 4 5&lt;BR /&gt;2 3 4 6&lt;BR /&gt;4 5 6 7&lt;BR /&gt;3 4 7 8&lt;BR /&gt;6 8 9 3&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;options mprint;&lt;BR /&gt;%macro reg(comb_no=,ar_pos=);&lt;BR /&gt;data vars&amp;amp;comb_no (keep=v1-v&amp;amp;comb_no);&lt;BR /&gt;array v(2:6) $4 ('X_t' 'X_t1' 'X_t2' 'Y_t1','Y_t2');&lt;BR /&gt;ncomb=comb(5,&amp;amp;comb_no);&lt;BR /&gt;do j=1 to ncomb;&lt;BR /&gt;call lexcomb(j, &amp;amp;comb_no, of v(*));&lt;BR /&gt;put (v1-v&amp;amp;ar_pos) ($5.);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;call symputx('regs',ncomb);&lt;BR /&gt;run;&lt;BR /&gt;%mend reg;&lt;/P&gt;&lt;P&gt;*also have to form a loop so that it calls the macro 5 times in a single do loop.&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;%reg(comb_no=1,ar_pos=1);&lt;BR /&gt;%reg(comb_no=2,ar_pos=2);&lt;BR /&gt;%reg(comb_no=3,ar_pos=3);&lt;BR /&gt;%reg(comb_no=4,ar_pos=4);&lt;BR /&gt;%reg(comb_no=5,ar_pos=5);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=work.conc;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data all (keep=full);&lt;BR /&gt;set conc;&lt;BR /&gt;full=catx(' ',v1,v2,v3,v4,v5);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=work.all;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data v1;&lt;BR /&gt;set all (firstobs=1 obs=1);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data m_data;&lt;BR /&gt;set work.ts_data (keep=Y_t X_t);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc reg data=m_data plots=none;&lt;BR /&gt;model Y_t = X_t;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 10:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680410#M32725</guid>
      <dc:creator>pshankar</dc:creator>
      <dc:date>2020-08-31T10:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Building of Regression Model using all the possible combination of variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680413#M32726</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/342925"&gt;@pshankar&lt;/a&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are you trying to accomplish here? Do you want to run all linear models for som variables and choose the best? Or something else? In either case, a macro is probably not the easiest way to go.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 11:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680413#M32726</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-08-31T11:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Building of Regression Model using all the possible combination of variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680414#M32727</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I want to run linear model for the all possible combination of variable and&amp;nbsp; choose one of the best model. Like, If in the data&amp;nbsp; 3 independent variable is there then total of 7 model will be there. So I just want to design the code in such a way that if i will change the the input data with 5 variable then sas code automatically generate the 31 model. And after generating the model i will pick one with the best result. In R language it is easier to do but i am finding bit difficult in sas to do this. Is it possible to design the sas macro in such a fashion?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 11:31:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680414#M32727</guid>
      <dc:creator>pshankar</dc:creator>
      <dc:date>2020-08-31T11:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Building of Regression Model using all the possible combination of variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680416#M32728</link>
      <description>&lt;P&gt;Macro is not needed, all possible subsets regression is built into PROC REG, as stated in the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_reg_details08.htm&amp;amp;locale=en" target="_self"&gt;documentation&lt;/A&gt; (highlighting is mine).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;BLOCKQUOTE&gt;
&lt;H4 class="xis-title"&gt;R2&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Selection (RSQUARE)&lt;/H4&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/DIV&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The RSQUARE method finds subsets of independent variables that best predict a dependent variable by linear regression in the given sample. You can specify the largest and smallest number of independent variables to appear in a subset and the number of subsets of each size to be selected. &lt;FONT color="#FF0000"&gt;The RSQUARE method can efficiently perform all possible subset regressions and display the models in decreasing order of R square magnitude within each subset size.&lt;/FONT&gt; Other statistics are available for comparing subsets of different sizes. These statistics, as well as estimated regression coefficients, can be displayed or output to a SAS data set.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Having said that, I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;, this is generally not a good thing to do, and few people use this approach these days to finding regression models. Just because your computer can do the calculations does not mean you&amp;nbsp;&lt;EM&gt;should&lt;/EM&gt; do these calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other possible methods for selecting a regression model are &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_pls_toc.htm&amp;amp;locale=en" target="_self"&gt;PROC PLS&lt;/A&gt; and &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_glmselect_toc.htm&amp;amp;locale=en" target="_self"&gt;PROC GLMSELECT&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 11:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680416#M32728</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-31T11:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Building of Regression Model using all the possible combination of variable</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680424#M32729</link>
      <description>&lt;P&gt;Paige mentioned PROC GLMSELECT, but I will make a stronger statement: If you want to perform model selection over all candidate models, use PROC GLMSELECT, not PROC REG.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 12:42:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Building-of-Regression-Model-using-all-the-possible-combination/m-p/680424#M32729</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-08-31T12:42:59Z</dc:date>
    </item>
  </channel>
</rss>

