<?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: Save regression equation for later use in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/730037#M35401</link>
    <description>Opps. My bad. I reckon that proc genmod like proc reg .</description>
    <pubDate>Tue, 30 Mar 2021 10:09:12 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-03-30T10:09:12Z</dc:date>
    <item>
      <title>Save regression equation for later use</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729738#M35374</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Please find example to&amp;nbsp; data set that check if the football&amp;nbsp; player scored goals in last game.&lt;/P&gt;
&lt;P&gt;The dependent variable is GoalInd (binary) and there are 3 independent variables X1,X2,X3.&lt;/P&gt;
&lt;P&gt;I used proc genmod to build regression model.&lt;/P&gt;
&lt;P&gt;I want to use the regression equation that was created in order to calculate probability for new cases (data set new).&lt;/P&gt;
&lt;P&gt;As I understand from my previous post there are 2 recommended way to do it:&lt;/P&gt;
&lt;P&gt;Way1-Create a data set that store the regression equation&amp;nbsp; and then use it to calculate predicted values for new cases&lt;/P&gt;
&lt;P&gt;Way2- Use store statement in proc reg and then use Proc PLM to&amp;nbsp; calculate predicted values for new cases&lt;/P&gt;
&lt;P&gt;May you show please the code for way 1 and also the code for way 2?&lt;/P&gt;
&lt;P&gt;thank you so much&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 

Data Rawtbl;
input ID GoalInd X1 X2 $ X3 $;
cards;
1 0 20 W N
2 0 30 W N
3 1 20 B N
4 1 20 B N
5 0 30 B Y
6 0 20 B Y
7 1 20 W N
8 0 30 B Y
9 1 20 W N
10 1 30 B N
;
run;
/*Step1-Build regression equatiuon*/
proc genmod data=Rawtbl  namelen=60 descending;
class X1 X2  ;
model GoalInd=X1 X2  /dist=binomial link=logit  type3 wald;
output out=Build_NewModel1
p=P_BAD xbeta=logit;
run;

/*Step1-Test the model on a new data set*/
Data new;
input ID GoalInd X1 X2 $ X3 $;
cards;
11 0 30 B Y
12 0 20 W N
13 1 30 B N
14 1 20 B Y
15 0 30 B Y
;
run;
/*Way1 to save the regression equation and use it */
/*How can I save the Regression equation in a data set?*/
/*How can I use this data set to calculate predicted outcome for the new data set*/

/*Way2 to save the regression equation and use it */
/*How can I use store statement in proc genmod in order to save the resression equation?*/
/*How can I use these regression equation (that was stored in store statement in proc genmod) to 
calculate predicted outcome for the new data set*/
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Mar 2021 09:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729738#M35374</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-03-29T09:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Save regression equation for later use</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729768#M35378</link>
      <description>you can use option &lt;BR /&gt;proc genmod ...... outest=est &lt;BR /&gt;to save estimate coefficient and score the test data lately .&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; wrote many blog  about this topic .</description>
      <pubDate>Mon, 29 Mar 2021 12:54:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729768#M35378</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-03-29T12:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Save regression equation for later use</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729771#M35379</link>
      <description>&lt;P&gt;You can use the STORE command in PROC GENMOD or PROC GLM and then PROC PLM to get predicted values. Example:&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_plm_examples01.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_plm_examples01.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 12:59:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729771#M35379</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-03-29T12:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: Save regression equation for later use</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729784#M35381</link>
      <description>&lt;P&gt;The following SAS Usage Note:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;A href="http://support.sas.com/kb/33307" target="_blank"&gt;http://support.sas.com/kb/33307&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;demonstrates 4 ways to score new observations using a previously fitted model&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 13:35:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729784#M35381</guid>
      <dc:creator>STAT_Kathleen</dc:creator>
      <dc:date>2021-03-29T13:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: Save regression equation for later use</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729823#M35387</link>
      <description>&lt;P&gt;One of Rick's blog posts that covers your question is here and outlines five different ways and some of the differences between them.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Missing response trick (ie combining regression + predictive data set)&lt;/LI&gt;
&lt;LI&gt;PROC SCORE&lt;/LI&gt;
&lt;LI&gt;SCORE statement within PROC&lt;/LI&gt;
&lt;LI&gt;STORE Statement + PROC PLM&lt;/LI&gt;
&lt;LI&gt;CODE statement - generates data step code to generate your predictive values. If you want to understand the math behind your formula this is a good optin.&amp;nbsp;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 15:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729823#M35387</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-29T15:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Save regression equation for later use</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729856#M35394</link>
      <description>&lt;P&gt;Thank you, however when I add outest=est then I get an error&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 
proc genmod data=Rawtbl outest=est namelen=60 descending  ;
class X1 X2  ;
model GoalInd=X1 X2  /dist=binomial link=logit  type3 wald;
output out=Build_NewModel1
p=P_BAD xbeta=logit;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Mar 2021 18:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729856#M35394</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-03-29T18:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Save regression equation for later use</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729860#M35395</link>
      <description>There is no OUTEST option in PROC GENMOD. Please see the documentation. &lt;BR /&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_genmod_syntax01.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_genmod_syntax01.htm&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Other methods to do this have been shown by several other people so you'll need to use a different option.</description>
      <pubDate>Mon, 29 Mar 2021 19:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/729860#M35395</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-29T19:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Save regression equation for later use</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/730037#M35401</link>
      <description>Opps. My bad. I reckon that proc genmod like proc reg .</description>
      <pubDate>Tue, 30 Mar 2021 10:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Save-regression-equation-for-later-use/m-p/730037#M35401</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-03-30T10:09:12Z</dc:date>
    </item>
  </channel>
</rss>

