<?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 numerical and categorical variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859625#M42485</link>
    <description>&lt;P&gt;Thank you very much for all your help!&lt;/P&gt;</description>
    <pubDate>Sun, 19 Feb 2023 15:54:50 GMT</pubDate>
    <dc:creator>Taliah</dc:creator>
    <dc:date>2023-02-19T15:54:50Z</dc:date>
    <item>
      <title>Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859615#M42479</link>
      <description>&lt;P&gt;We are running a linear regression model with 4 numerical independent variables predicting a numerical dependent variable. We now need to add two additional categorical independent varables.&lt;/P&gt;
&lt;P&gt;The client wants a seperate prediction for each commbination of the two new categorical independent variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thinknig of proc GLM with the categorical variables in the class statement, but can't see how to get a separate prediction forf each&amp;nbsp;commbination of the two new categorical independent variables. All help will be appreciated, Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 14:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859615#M42479</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2023-02-19T14:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859617#M42480</link>
      <description>That is what the CLASS statement is for. Many modeling procedures (GLM, GENMOD, GLIMMIX, and so on) have a CLASS statement that allows you to specify the variables that are categorical. Then those variables can also be included in the MODEL statement along with the numerical, continuous variables. You will see examples in the documentation of the procedures. If you have been using PROC REG, you will need to change to PROC GLM or one of the others that have a CLASS statement.</description>
      <pubDate>Sun, 19 Feb 2023 14:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859617#M42480</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-02-19T14:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859619#M42481</link>
      <description>&lt;P&gt;Thank you! using proc GLM the way you suggest, how can I get a separate predition for each combinatin of teh two categorical variables?&lt;/P&gt;
&lt;P&gt;Also we just realized we will need to do the same also for a model where we use autoreg due to autocorrelation in teh data. Id there a way to add teh two class variables to proc autoreg or another proocn that can handle data with autocorrelation (we can add the lag of the dependent variable to the GLM model' but that would not be the same as running proc autoreg). Thamnk you!&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 14:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859619#M42481</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2023-02-19T14:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859620#M42482</link>
      <description>Include the interaction of the two categorical variables. For example, for two categorical variables, a and b, their interaction is a*b:&lt;BR /&gt;&lt;BR /&gt;class a b;&lt;BR /&gt;model y=x1 x2 a b a*b;</description>
      <pubDate>Sun, 19 Feb 2023 14:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859620#M42482</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-02-19T14:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859622#M42483</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Include the interaction of the two categorical variables. For example, for two categorical variables, a and b, their interaction is a*b:&lt;BR /&gt;&lt;BR /&gt;class a b;&lt;BR /&gt;model y=x1 x2 a b a*b;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Thank you! I use the "PREDICTED" value I get from the model output. Will the intercation you wrote result in getting a predicted value for each combination?&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 15:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859622#M42483</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2023-02-19T15:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859623#M42484</link>
      <description>You will get a predicted value for each observation in your data set. So, observations with different combinations of values of all of the variables in your model will have different predicted values. If what you want is a single predicted mean value for just the combinations of those two categorical variables, then you probably will want to add the LSMEANS statement. For example:  &lt;BR /&gt;lsmeans a*b;</description>
      <pubDate>Sun, 19 Feb 2023 15:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859623#M42484</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-02-19T15:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859625#M42485</link>
      <description>&lt;P&gt;Thank you very much for all your help!&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 15:54:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859625#M42485</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2023-02-19T15:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859650#M42490</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/256609"&gt;@Taliah&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The client wants a seperate prediction for each commbination of the two new categorical independent variables.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Although &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt; has provide a complete and correct answer, I feel it would be helpful to point out that you do NOT get predictions for "each combination" of the independent variable. You get predictions for each observation. This has nothing to do with SAS, this is how the math works.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 20:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859650#M42490</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-19T20:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Regression with numerical and categorical variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859669#M42492</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2023 07:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Regression-with-numerical-and-categorical-variables/m-p/859669#M42492</guid>
      <dc:creator>Taliah</dc:creator>
      <dc:date>2023-02-20T07:16:57Z</dc:date>
    </item>
  </channel>
</rss>

