<?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 PROC GLM -- fitted values for subset of variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GLM-fitted-values-for-subset-of-variables/m-p/439159#M23152</link>
    <description>&lt;P&gt;I would like to obtain fitted variables for a GLM regression model excluding the class variable. I am familiar with getting fitted values for a full statistical model in general, which can be done with something of the form&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc glm data=this.data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; class categorical_var;&lt;/P&gt;&lt;P&gt;&amp;nbsp; model y x1 x2 categorical_var / solution;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=this.outdata predicted=yhat;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is yhat to contain *just* the fittted values for the x1 and x2 variables, excluding the categorical_var values. Is anyone aware of a way (preferably simple!) to do this without viewing the regression output and hard-coding in the parameters for x1 and x2 myself? I am using SAS 9.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2018 03:20:19 GMT</pubDate>
    <dc:creator>jwa14</dc:creator>
    <dc:date>2018-02-22T03:20:19Z</dc:date>
    <item>
      <title>PROC GLM -- fitted values for subset of variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GLM-fitted-values-for-subset-of-variables/m-p/439159#M23152</link>
      <description>&lt;P&gt;I would like to obtain fitted variables for a GLM regression model excluding the class variable. I am familiar with getting fitted values for a full statistical model in general, which can be done with something of the form&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc glm data=this.data;&lt;/P&gt;&lt;P&gt;&amp;nbsp; class categorical_var;&lt;/P&gt;&lt;P&gt;&amp;nbsp; model y x1 x2 categorical_var / solution;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=this.outdata predicted=yhat;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is yhat to contain *just* the fittted values for the x1 and x2 variables, excluding the categorical_var values. Is anyone aware of a way (preferably simple!) to do this without viewing the regression output and hard-coding in the parameters for x1 and x2 myself? I am using SAS 9.4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 03:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GLM-fitted-values-for-subset-of-variables/m-p/439159#M23152</guid>
      <dc:creator>jwa14</dc:creator>
      <dc:date>2018-02-22T03:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GLM -- fitted values for subset of variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GLM-fitted-values-for-subset-of-variables/m-p/439167#M23153</link>
      <description>&lt;P&gt;First method:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove the categorical variable from the model. That will give you estimates that are weighted by the size of each class in your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second method&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the classes to have equal weight in your estimates, you could use a variant of the &lt;EM&gt;adding missing values to the data&lt;/EM&gt; technique:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data carsReg;
set sashelp.cars;
id = _n_;
output;
call missing(MSRP);
extra = 1;
do type = "Hybrid", "SUV", "Sedan", "Sports", "Truck", "Wagon";
    output;
    end;
keep id MSRP horsepower weight type extra;
run;

proc glm data=carsReg plots=none;
class type;
model MSRP = horsepower weight type;
output out=carsPred predicted=MSRP_pred stdp=MSRP_STDP;
run;
quit;

proc sql;
create table carsAvgType as
select
    id, horsepower, weight,
    mean(MSRP_pred) as MSRP_pred,
    sqrt(mean(MSRP_STDP**2)) as MSRP_STDP
from carsPred
where extra
group by id, horsepower, weight;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Feb 2018 04:54:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GLM-fitted-values-for-subset-of-variables/m-p/439167#M23153</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-02-22T04:54:01Z</dc:date>
    </item>
  </channel>
</rss>

