<?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: Output PROC GLM results to table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683362#M206968</link>
    <description>&lt;P&gt;Here's some instructions and explanations on how to capture output that is shown. &lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2017/03/31/capturing-output-from-any-procedure-with-an-ods-output-statement/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2017/03/31/capturing-output-from-any-procedure-with-an-ods-output-statement/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table Names for PROC GLM are here, I think you want FitStatistics&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_glm_details70.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_glm_details70.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add the following before your proc, you'll probably want to modify your macro so that the output has a unique name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output fitstatistics = want;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288620"&gt;@bkq32&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm calculating CV and RMSE for several variables and would like to output the PROC GLM results to a SAS table. Is there a way to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Create sample data with repeat measures;
data have ( keep = subjectid weight momwtgain cigsperday );
 format subjectid;
 set sashelp.bweight;
 if _N_ &amp;lt;= 6;
 subjectid = _N_;
 if _N_ = 2 then subjectid = 1;
 if _N_ in ( 3, 4 ) then subjectid = 2;
 if _N_ in ( 5, 6 ) then subjectid = 3;
 if _N_ = 1 then cigsperday = 1;
run;


*Calculate CV and RMSE;
%macro cv ( covar );
proc glm data = have;
 model &amp;amp;covar. = subjectid;
 ods select FitStatistics;
run; quit;
%mend cv;


%cv ( weight );
%cv ( momwtgain );
%cv ( cigsperday );


*Would like a table that looks something like this;
data want; 
 length Name $20.;
 input Name $ CV RMSE;
cards;
Weight 23.43 851.41
MomWtGain -141.24 9.89
CigsPerDay 229.13 0.38
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Sep 2020 21:11:20 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-09-11T21:11:20Z</dc:date>
    <item>
      <title>Output PROC GLM results to table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683361#M206967</link>
      <description>&lt;P&gt;I'm calculating CV and RMSE for several variables and would like to output the PROC GLM results to a SAS table. Is there a way to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Create sample data with repeat measures;
data have ( keep = subjectid weight momwtgain cigsperday );
 format subjectid;
 set sashelp.bweight;
 if _N_ &amp;lt;= 6;
 subjectid = _N_;
 if _N_ = 2 then subjectid = 1;
 if _N_ in ( 3, 4 ) then subjectid = 2;
 if _N_ in ( 5, 6 ) then subjectid = 3;
 if _N_ = 1 then cigsperday = 1;
run;


*Calculate CV and RMSE;
%macro cv ( covar );
proc glm data = have;
 model &amp;amp;covar. = subjectid;
 ods select FitStatistics;
run; quit;
%mend cv;


%cv ( weight );
%cv ( momwtgain );
%cv ( cigsperday );


*Would like a table that looks something like this;
data want; 
 length Name $20.;
 input Name $ CV RMSE;
cards;
Weight 23.43 851.41
MomWtGain -141.24 9.89
CigsPerDay 229.13 0.38
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Sep 2020 21:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683361#M206967</guid>
      <dc:creator>bkq32</dc:creator>
      <dc:date>2020-09-11T21:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Output PROC GLM results to table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683362#M206968</link>
      <description>&lt;P&gt;Here's some instructions and explanations on how to capture output that is shown. &lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/sastraining/2017/03/31/capturing-output-from-any-procedure-with-an-ods-output-statement/" target="_blank"&gt;https://blogs.sas.com/content/sastraining/2017/03/31/capturing-output-from-any-procedure-with-an-ods-output-statement/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table Names for PROC GLM are here, I think you want FitStatistics&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_glm_details70.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_glm_details70.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add the following before your proc, you'll probably want to modify your macro so that the output has a unique name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods output fitstatistics = want;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288620"&gt;@bkq32&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm calculating CV and RMSE for several variables and would like to output the PROC GLM results to a SAS table. Is there a way to do this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Create sample data with repeat measures;
data have ( keep = subjectid weight momwtgain cigsperday );
 format subjectid;
 set sashelp.bweight;
 if _N_ &amp;lt;= 6;
 subjectid = _N_;
 if _N_ = 2 then subjectid = 1;
 if _N_ in ( 3, 4 ) then subjectid = 2;
 if _N_ in ( 5, 6 ) then subjectid = 3;
 if _N_ = 1 then cigsperday = 1;
run;


*Calculate CV and RMSE;
%macro cv ( covar );
proc glm data = have;
 model &amp;amp;covar. = subjectid;
 ods select FitStatistics;
run; quit;
%mend cv;


%cv ( weight );
%cv ( momwtgain );
%cv ( cigsperday );


*Would like a table that looks something like this;
data want; 
 length Name $20.;
 input Name $ CV RMSE;
cards;
Weight 23.43 851.41
MomWtGain -141.24 9.89
CigsPerDay 229.13 0.38
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 21:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683362#M206968</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-11T21:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Output PROC GLM results to table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683364#M206970</link>
      <description>Or try the PERSIST option on the ODS OUTPUT statement, not sure if that would work here.</description>
      <pubDate>Fri, 11 Sep 2020 21:14:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683364#M206970</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-11T21:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Output PROC GLM results to table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683366#M206971</link>
      <description>&lt;P&gt;Thank you! I ended up doing the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro cv ( covar );
ods output fitstatistics = x_&amp;amp;covar.;


proc glm data = have;
 model &amp;amp;covar. = subjectid;
 ods select FitStatistics;
run; quit;
%mend cv;


%cv ( weight );
%cv ( momwtgain );
%cv ( cigsperday );


data want;
 set x_:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Sep 2020 21:48:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-PROC-GLM-results-to-table/m-p/683366#M206971</guid>
      <dc:creator>bkq32</dc:creator>
      <dc:date>2020-09-11T21:48:57Z</dc:date>
    </item>
  </channel>
</rss>

