<?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: Existence of model-applying procedure in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17958#M3476</link>
    <description>Thanks, Darryl.&lt;BR /&gt;
&lt;BR /&gt;
I was able to use Proc Score with the macro you spelled out above. I appreciate your help.&lt;BR /&gt;
&lt;BR /&gt;
Becky</description>
    <pubDate>Thu, 15 May 2008 14:58:47 GMT</pubDate>
    <dc:creator>becky</dc:creator>
    <dc:date>2008-05-15T14:58:47Z</dc:date>
    <item>
      <title>Existence of model-applying procedure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17956#M3474</link>
      <description>I'm using proc reg to create a linear regression model and am wondering if there is a procedure that will create and apply the equation that is created by the model so that I do not have to. My problem is that I have about 1,000 variables, and the forward selection model spits out about 300 in the model. That's a lot to type! I also have about 300,000 records that I need to score with this model. &lt;BR /&gt;
&lt;BR /&gt;
Any help would be greatly appreciated (even if it is "sorry, that doesn't exist").&lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Becky</description>
      <pubDate>Thu, 15 May 2008 11:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17956#M3474</guid>
      <dc:creator>becky</dc:creator>
      <dc:date>2008-05-15T11:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: Existence of model-applying procedure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17957#M3475</link>
      <description>Becky&lt;BR /&gt;
&lt;BR /&gt;
Three items to discuss&lt;BR /&gt;
-1) Model diagnostics: if you want to score your modeling datasets see the output p=phat r=residuals options in the documentation for PROC REG.&lt;BR /&gt;
-2) Validation: Once your model is done output the betas from the OUTEST option in the PROC REG statement.  Then use PROC SCORE to score your file. PROC SCORE can be tricky so see the documentation for details and examples.&lt;BR /&gt;
&lt;BR /&gt;
Since you have some many predictor variables (see #3 below on that) you will need to dynamically build the VAR statement in PROC SCORE.&lt;BR /&gt;
&lt;BR /&gt;
I modified the example in the PROC SCORE documentation to do this&lt;BR /&gt;
&lt;BR /&gt;
   data Fitness; &lt;BR /&gt;
      input Age Weight Oxygen RunTime RestPulse RunPulse @@; &lt;BR /&gt;
      datalines; &lt;BR /&gt;
   44 89.47  44.609 11.37 62 178     40 75.07  45.313 10.07 62 185 &lt;BR /&gt;
   44 85.84  54.297  8.65 45 156     42 68.15  59.571  8.17 40 166 &lt;BR /&gt;
   38 89.02  49.874  9.22 55 178     47 77.45  44.811 11.63 58 176 &lt;BR /&gt;
   40 75.98  45.681 11.95 70 176     43 81.19  49.091 10.85 64 162 &lt;BR /&gt;
   44 81.42  39.442 13.08 63 174     38 81.87  60.055  8.63 48 170 &lt;BR /&gt;
   44 73.03  50.541 10.13 45 168     45 87.66  37.388 14.03 56 186 &lt;BR /&gt;
   ; &lt;BR /&gt;
run;&lt;BR /&gt;
proc reg data=Fitness outest=RegOut; &lt;BR /&gt;
   OxyHat: model Oxygen=Age Weight RunTime RunPulse RestPulse; &lt;BR /&gt;
   output p=phat;&lt;BR /&gt;
      title 'REGRESSION SCORING EXAMPLE'; &lt;BR /&gt;
run; &lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc print data=RegOut; &lt;BR /&gt;
  title2 'OUTEST= Data Set from PROC REG'; &lt;BR /&gt;
run; &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
   proc print data=RScoreP; &lt;BR /&gt;
      title2 'Predicted Scores for Regression'; &lt;BR /&gt;
   run; &lt;BR /&gt;
 &lt;BR /&gt;
   proc score data=Fitness score=RegOut out=RScoreR type=parms; &lt;BR /&gt;
      var Oxygen Age Weight RunTime RunPulse RestPulse; &lt;BR /&gt;
   run; &lt;BR /&gt;
 &lt;BR /&gt;
   proc print data=RScoreR; &lt;BR /&gt;
      title2 'Negative Residual Scores for Regression'; &lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
* to dynamically only use the variables that you want for scoring;&lt;BR /&gt;
* modified from PROC SCORE example;&lt;BR /&gt;
%macro scoreit();&lt;BR /&gt;
&lt;BR /&gt;
proc contents data=RegOut out=Betas noprint;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  set Betas end=eof;&lt;BR /&gt;
  where type=1 and upcase(name) not in('OXYGEN','INTERCEPT','_RMSE_');&lt;BR /&gt;
  * type=1 means numeric variables;&lt;BR /&gt;
  * we do not want the y, intercept, or RMSE to be used as the betas;&lt;BR /&gt;
&lt;BR /&gt;
  call symput('var'||strip(put(_n_,8.)),strip(name));&lt;BR /&gt;
  if eof then call symput('numVars', strip(put(_n_,8.)));&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
  &lt;BR /&gt;
&lt;BR /&gt;
   proc score data=Fitness score=RegOut out=RScoreP type=parms; &lt;BR /&gt;
      var %do i=1 %to &amp;amp;numvars;&lt;BR /&gt;
            &amp;amp;&amp;amp;var&amp;amp;i&lt;BR /&gt;
          %end;;&lt;BR /&gt;
   run; &lt;BR /&gt;
&lt;BR /&gt;
%mend scoreit;&lt;BR /&gt;
%scoreit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/onlinedoc/913/docMainpage.jsp" target="_blank"&gt;http://support.sas.com/onlinedoc/913/docMainpage.jsp&lt;/A&gt; &lt;BR /&gt;
&lt;BR /&gt;
-3) Now for your biggest problem. Having 1000 predictor variables is extreme.  I'm not sure what you are modeling but using that many variables in a model will cause overfitting and instability.  Each variable adds a dimension and with 300-1000 the "curse of dimensionality" will most likely occur.&lt;BR /&gt;
&lt;BR /&gt;
-Darryl</description>
      <pubDate>Thu, 15 May 2008 13:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17957#M3475</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2008-05-15T13:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Existence of model-applying procedure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17958#M3476</link>
      <description>Thanks, Darryl.&lt;BR /&gt;
&lt;BR /&gt;
I was able to use Proc Score with the macro you spelled out above. I appreciate your help.&lt;BR /&gt;
&lt;BR /&gt;
Becky</description>
      <pubDate>Thu, 15 May 2008 14:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17958#M3476</guid>
      <dc:creator>becky</dc:creator>
      <dc:date>2008-05-15T14:58:47Z</dc:date>
    </item>
    <item>
      <title>Re: Existence of model-applying procedure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17959#M3477</link>
      <description>One of the key features of Darryl's solution is the "outest=" option for "proc reg".  It defines a SAS dataset that will hold the results, the estimated/derived parameters.  This is what then can be used to automate the application of the model through another proc that is designed to use it, or within your own Data step and/or macro.</description>
      <pubDate>Fri, 16 May 2008 12:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Existence-of-model-applying-procedure/m-p/17959#M3477</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-05-16T12:41:03Z</dc:date>
    </item>
  </channel>
</rss>

