<?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 to save out a model and apply on a new dataset?! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-save-out-a-model-and-apply-on-a-new-dataset/m-p/799527#M314398</link>
    <description>&lt;P&gt;Say run a REG model, below. How to save out the model and apply on a new dataset (newclass)&lt;/P&gt;
&lt;P&gt;to get the predicted values and residuals?! Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc reg data=sashelp.class;&lt;BR /&gt;model height=age;&lt;BR /&gt;run;quit;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 08:56:27 GMT</pubDate>
    <dc:creator>hellohere</dc:creator>
    <dc:date>2022-03-02T08:56:27Z</dc:date>
    <item>
      <title>How to save out a model and apply on a new dataset?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-save-out-a-model-and-apply-on-a-new-dataset/m-p/799527#M314398</link>
      <description>&lt;P&gt;Say run a REG model, below. How to save out the model and apply on a new dataset (newclass)&lt;/P&gt;
&lt;P&gt;to get the predicted values and residuals?! Thanks,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc reg data=sashelp.class;&lt;BR /&gt;model height=age;&lt;BR /&gt;run;quit;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 08:56:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-save-out-a-model-and-apply-on-a-new-dataset/m-p/799527#M314398</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2022-03-02T08:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to save out a model and apply on a new dataset?!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-save-out-a-model-and-apply-on-a-new-dataset/m-p/799545#M314409</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/409584"&gt;@hellohere&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way is to use the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_reg_syntax04.htm" target="_blank" rel="noopener"&gt;CODE statement&lt;/A&gt; in the original PROC REG step and to use the stored code later in a DATA step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc reg data=sashelp.class;
model height=age;
code file='C:\Temp\regscore.sas' residual;
quit;

data want;
set newclass;
%include 'C:\Temp\regscore.sas';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Dataset WANT will contain variables &lt;FONT face="courier new,courier"&gt;P_Height&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;R_Height&lt;/FONT&gt; with the predicted values and residuals, respectively.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See also two of Rick Wicklin's blog posts about scoring of regression models:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model.html" target="_blank" rel="noopener"&gt;The missing value trick for scoring a regression model&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html" target="_blank" rel="noopener"&gt;Techniques for scoring a regression model in SAS&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 02 Mar 2022 10:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-save-out-a-model-and-apply-on-a-new-dataset/m-p/799545#M314409</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-03-02T10:49:20Z</dc:date>
    </item>
  </channel>
</rss>

