<?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 How do I create an interaction term with four variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554217#M154171</link>
    <description>&lt;P&gt;I have a data of the form below. And I want to find the &lt;STRONG&gt;best model&lt;/STRONG&gt; that predicts y while &lt;STRONG&gt;considering interactions as well as quadratic terms using PROC REG&lt;/STRONG&gt;. How do I go about it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bb;
input x1 x2 y x3 x4 x5 ;

datalines;

0.442	0.672	9.2	0.1962	13.0769
0.435	0.797	11.7	-0.3038	-31.9231
0.456	0.761	15.8	-0.2038	-21.9231
0.416	0.651	8.6	-0.4038	-31.9231
0.449	0.9     23.2	0.2962	-6.9231
0.431	0.78  	27.4	-0.2038	13.0769
0.487	0.771	9.3	-0.3038	-26.9231
0.469	0.75    16	0.1962	 23.0769
0.435	0.818	4.7	0.2962	23.0769
0.48	0.825	12.5	0.0962	-1.9231
0.516	0.632	20.1	0.2962	33.0769
0.493	0.757	9.1	0.2962	33.0769
0.374	0.709	8.1	-0.3038	-26.9231
0.424	0.782	8.6	-0.5038	-26.9231
0.441	0.775	20.3	-0.4038	-31.9231
0.503	0.88    25	0.1962	8.0769
0.503	0.833	19.2	-0.1038	-17.9231
0.425	0.571	3.3	0.9962	13.0769
0.371	0.816	11.2	-0.3038	-1.9231
0.504	0.714	10.5	0.4962	28.0769
0.4	0.765	10.1	0.1962	13.0769
0.482	0.655	7.2	0.6962	51.0769
0.428	0.728	9	0.1962	23.0769
0.559	0.721	24.6	0.5962	18.0769
0.441	0.757	12.6	-0.2038	-21.9231
0.492	0.747	5.6	-0.0038	8.0769
0.402	0.739	8.7	0.1962	-1.9231
0.415	0.713	7.7	-0.5038	-31.9231
0.492	0.742	24.1	-0.1038	23.0769
0.484	0.861	11.7	-0.2038	-26.9231
0.387	0.721	7.7	-0.6038	-36.9231
0.436	0.785	9.6	-0.6038	-19.9231
0.482	0.655	7.2	0.6962	51.0769
0.34	0.821	12.3	-0.5038	-31.9231
0.516	0.728	8.9	0.0962	28.0769
0.475	0.846	13.6	-0.2038	-1.9231
0.412	0.813	11.2	-0.8038	-51.9231
0.411	0.595	2.8	0.2962	18.0769
0.407	0.573	3.2	0.3962	33.0769
0.445	0.726	9.4	0.6962	16.0769
0.291	0.707	11.9	-0.7038	-56.9231
0.449	0.804	15.4	-0.4038	-11.9231
0.546	0.784	7.4	0.1962	23.0769
0.48  	0.744	18.9	0.3962	23.0769
0.528	0.79	12.2	-0.5038	-31.9231
0.352	0.701	11	-0.9038	-26.9231
0.414	0.778	2.8	0.4962	33.0769
0.425	0.872	11.8	-0.8038	-31.9231
0.599	0.713	17.1	0.7962	28.0769
0.482	0.701	11.6	0.1962	13.0769
0.457	0.734	5.8	0.1962	3.0769
0.435	0.764	8.3	0.3962	18.0769
;
run;

proc print data=bb;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Apr 2019 11:46:21 GMT</pubDate>
    <dc:creator>JUMMY</dc:creator>
    <dc:date>2019-04-26T11:46:21Z</dc:date>
    <item>
      <title>How do I create an interaction term with four variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554217#M154171</link>
      <description>&lt;P&gt;I have a data of the form below. And I want to find the &lt;STRONG&gt;best model&lt;/STRONG&gt; that predicts y while &lt;STRONG&gt;considering interactions as well as quadratic terms using PROC REG&lt;/STRONG&gt;. How do I go about it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data bb;
input x1 x2 y x3 x4 x5 ;

datalines;

0.442	0.672	9.2	0.1962	13.0769
0.435	0.797	11.7	-0.3038	-31.9231
0.456	0.761	15.8	-0.2038	-21.9231
0.416	0.651	8.6	-0.4038	-31.9231
0.449	0.9     23.2	0.2962	-6.9231
0.431	0.78  	27.4	-0.2038	13.0769
0.487	0.771	9.3	-0.3038	-26.9231
0.469	0.75    16	0.1962	 23.0769
0.435	0.818	4.7	0.2962	23.0769
0.48	0.825	12.5	0.0962	-1.9231
0.516	0.632	20.1	0.2962	33.0769
0.493	0.757	9.1	0.2962	33.0769
0.374	0.709	8.1	-0.3038	-26.9231
0.424	0.782	8.6	-0.5038	-26.9231
0.441	0.775	20.3	-0.4038	-31.9231
0.503	0.88    25	0.1962	8.0769
0.503	0.833	19.2	-0.1038	-17.9231
0.425	0.571	3.3	0.9962	13.0769
0.371	0.816	11.2	-0.3038	-1.9231
0.504	0.714	10.5	0.4962	28.0769
0.4	0.765	10.1	0.1962	13.0769
0.482	0.655	7.2	0.6962	51.0769
0.428	0.728	9	0.1962	23.0769
0.559	0.721	24.6	0.5962	18.0769
0.441	0.757	12.6	-0.2038	-21.9231
0.492	0.747	5.6	-0.0038	8.0769
0.402	0.739	8.7	0.1962	-1.9231
0.415	0.713	7.7	-0.5038	-31.9231
0.492	0.742	24.1	-0.1038	23.0769
0.484	0.861	11.7	-0.2038	-26.9231
0.387	0.721	7.7	-0.6038	-36.9231
0.436	0.785	9.6	-0.6038	-19.9231
0.482	0.655	7.2	0.6962	51.0769
0.34	0.821	12.3	-0.5038	-31.9231
0.516	0.728	8.9	0.0962	28.0769
0.475	0.846	13.6	-0.2038	-1.9231
0.412	0.813	11.2	-0.8038	-51.9231
0.411	0.595	2.8	0.2962	18.0769
0.407	0.573	3.2	0.3962	33.0769
0.445	0.726	9.4	0.6962	16.0769
0.291	0.707	11.9	-0.7038	-56.9231
0.449	0.804	15.4	-0.4038	-11.9231
0.546	0.784	7.4	0.1962	23.0769
0.48  	0.744	18.9	0.3962	23.0769
0.528	0.79	12.2	-0.5038	-31.9231
0.352	0.701	11	-0.9038	-26.9231
0.414	0.778	2.8	0.4962	33.0769
0.425	0.872	11.8	-0.8038	-31.9231
0.599	0.713	17.1	0.7962	28.0769
0.482	0.701	11.6	0.1962	13.0769
0.457	0.734	5.8	0.1962	3.0769
0.435	0.764	8.3	0.3962	18.0769
;
run;

proc print data=bb;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 11:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554217#M154171</guid>
      <dc:creator>JUMMY</dc:creator>
      <dc:date>2019-04-26T11:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an interaction term with four variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554220#M154172</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/226541"&gt;@JUMMY&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a data of the form below. And I want to find the &lt;STRONG&gt;best model&lt;/STRONG&gt; that predicts y while &lt;STRONG&gt;considering interactions as well as quadratic terms using PROC REG&lt;/STRONG&gt;. How do I go about it?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can't do this in PROC REG. You can do this easily in PROC GLM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 12:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554220#M154172</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-26T12:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an interaction term with four variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554230#M154173</link>
      <description>How do I add interactions and quadratic terms using GLM?&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Apr 2019 12:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554230#M154173</guid>
      <dc:creator>JUMMY</dc:creator>
      <dc:date>2019-04-26T12:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an interaction term with four variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554232#M154174</link>
      <description>&lt;P&gt;You put them in the model statement, for example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=have;
    model y=x1 x2 x3 x4 x5 x1*x2 x1*x3 /* you type the rest of the interactions */
        x1*x1 x2*x2 x3*x3 x4*x4 x5*x5;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or even easier, if you want all possible main effects and two way interactions and quadratic effects&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc glm data=have;
    model y = x1|x2|x3|x4|x5@2 x1*x1 x2*x2 x3*x3 x4*x4 x5*x5;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Apr 2019 12:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-an-interaction-term-with-four-variables/m-p/554232#M154174</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-26T12:37:05Z</dc:date>
    </item>
  </channel>
</rss>

