<?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: How to use the model selection result to retrain the model. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/509270#M136892</link>
    <description>&lt;P&gt;I found&amp;nbsp; _glsind1,_glsind2, ....._glsindn are the macro variables storing the selected subsets that can be used directly in step 2. But still thanks for the help.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Oct 2018 19:05:36 GMT</pubDate>
    <dc:creator>liyongkai800</dc:creator>
    <dc:date>2018-10-31T19:05:36Z</dc:date>
    <item>
      <title>How to use the model selection result to retrain the model.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/508928#M136733</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I use&amp;nbsp; proc glmselect to select some variables, and then want to use those variables to retrain the model. Is there any way&lt;/P&gt;&lt;P&gt;to store those subsets?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step1 obtain the subsets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc glmselect data=mydata;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;model y=x1 x2 x3 x4 x5/selection=lasso;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;selected subsets:&lt;/P&gt;&lt;P&gt;For id=1, x1,x3 are selected.&lt;/P&gt;&lt;P&gt;For id=2, x2,x4 are selected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step2&lt;/P&gt;&lt;P&gt;proc genmod data=mydata;&lt;/P&gt;&lt;P&gt;by id&lt;/P&gt;&lt;P&gt;model y= ???(how)/dist=...;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to store the subsets and complete step 2?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Oct 2018 20:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/508928#M136733</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2018-10-30T20:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the model selection result to retrain the model.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/508998#M136767</link>
      <description>&lt;P&gt;Here is an example using call execute&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.heart out=heart; by sex; run;

/* Run the parameter selection procedure and capture the selections with ODS */
proc glmselect data=heart;
by sex;
model weight = ageAtStart height / selection=lasso;
ods output selectedEffects=se;
run;

/* define a macro for each regression, sending the parameter estimates to 
separate datasets*/
%macro myGenmod(by,effects);
title "Model for Sex=&amp;amp;by";
proc genmod data=heart;
where sex="&amp;amp;by";
by sex; /* Adds Sex to the parameter estimates dataset */
model weight = &amp;amp;effects;
ods output parameterEstimates=pe_&amp;amp;by;
run;
%mend myGenmod;

/* Call the macro for every by-group */
data _null_;
set se;
effects = transtrn(effects, "Intercept", "");
length line $200;
line = cats('%myGenmod(', Sex, ",", effects, ");");
put line;
call execute(line);
run;

/* Concatenate parameter estimates datasets */
data pe;
set pe_: ;
run;

title "Parameter estimates for both sexes";
proc print data=pe noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Oct 2018 04:22:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/508998#M136767</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-10-31T04:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the model selection result to retrain the model.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/509270#M136892</link>
      <description>&lt;P&gt;I found&amp;nbsp; _glsind1,_glsind2, ....._glsindn are the macro variables storing the selected subsets that can be used directly in step 2. But still thanks for the help.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/509270#M136892</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2018-10-31T19:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the model selection result to retrain the model.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/509293#M136899</link>
      <description>&lt;P&gt;Great find! In the interest of those reading this topic in the future, could you post the code that you ended up using? - Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Oct 2018 19:37:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/509293#M136899</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-10-31T19:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the model selection result to retrain the model.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/509632#M137023</link>
      <description>&lt;PRE&gt;Here is the example I follow, you may use it as the reference.&lt;BR /&gt;Also, the link is https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glmselect_sect021.htm&lt;BR /&gt;where you can find more details.&lt;BR /&gt;&lt;BR /&gt;proc glmselect data=one;
     by     byVar;
     class  classVar;
     model  y = classVar x1|x2|x3|x4|x5 @2 /
                    selection=stepwise(stop=aicc);
     output out=glmselectOutput;
   run; &lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;PRE&gt;   %macro LSMeansAnalysis;
      %do i=1 %to &amp;amp;_GLSNUMBYS;
         title1  "Analysis Using the Selected Model for BY group number &amp;amp;i";
         title2 "Selected Effects: &amp;amp;&amp;amp;_GLSIND&amp;amp;i";
          
         ods select LSMeans;
         proc glm data=glmselectOutput(where = (_BY_ = &amp;amp;i));
            class classVar;
            model y = &amp;amp;&amp;amp;_GLSIND&amp;amp;i;
            lsmeans classVar;
         run;quit;
      %end;            
   %mend;
   %LSMeansAnalysis;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Nov 2018 17:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-model-selection-result-to-retrain-the-model/m-p/509632#M137023</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2018-11-01T17:55:55Z</dc:date>
    </item>
  </channel>
</rss>

