<?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 report p values in multiple logistic regression using macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786642#M251206</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/410335"&gt;@cindyf&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ODS OUTPUT statement doesn't create the _parm dataset because of the NOPRINT option of the PROC LOGISTIC statement. So omit the NOPRINT option and use &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/p1b72ff70v3obrn16aanp1r9q2bu.htm" target="_blank" rel="noopener"&gt;ODS SELECT NONE&lt;/A&gt;&amp;nbsp;instead to suppress the printed output. With the PERSIST=PROC option of the&amp;nbsp;ODS OUTPUT statement you can tell SAS to add new observations to dataset _parm in each iteration of your macro loop. You should also close the PROC DATASETS step with a QUIT statement before subsequent ODS statements. Here's a modified version of your code including these suggestions (highlighted in blue):&lt;/P&gt;
&lt;PRE&gt;%let nCont = 100;
%macro RunReg(DSName, NumVars);
options nonotes;
proc datasets nolist;
  delete AllStats;
&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;quit;

ods select none;
ods output ParameterEstimates(persist=proc)=_parm;&lt;/FONT&gt;&lt;/STRONG&gt;
%do i = 1 %to &amp;amp;NumVars;

  proc logistic data=&amp;amp;DSName &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;/*&lt;/FONT&gt;&lt;/STRONG&gt; noprint &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;*/&lt;/FONT&gt;&lt;/STRONG&gt;
              outest=PE(rename=(read&amp;amp;i=Value));
  model rec = read&amp;amp;i;
  run;

  proc append base=AllStats data=pe;
  run;

%end;
&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;ods select all;&lt;/STRONG&gt;&lt;/FONT&gt;
options notes;
%mend RunReg;
%RunReg(sas1, &amp;amp;nCont)&lt;/PRE&gt;
&lt;P&gt;Having most of the statistics in dataset _parm, you maybe don't need the AllStats dataset anymore, so you could simplify the code considerably.&lt;/P&gt;</description>
    <pubDate>Sun, 19 Dec 2021 12:54:11 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2021-12-19T12:54:11Z</dc:date>
    <item>
      <title>how to report p values in multiple logistic regression using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786577#M251163</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to run hundreds of univariate logistic regression models with p values for each model. &amp;nbsp;This macro is able to generate actual beta, but I can't seem to get p values. I tried to insert&amp;nbsp;ODS OUTPUT ParameterEstimates=_parm;before logistic statement but the _parm dataset is no generated. Can anyone please help me? thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;%let nCont = 100; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;%macro RunReg(DSName, NumVars);&lt;/DIV&gt;&lt;DIV&gt;options nonotes; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc datasets nolist;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; delete AllStats; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;%do i = 1 %to &amp;amp;NumVars; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc logistic data=&amp;amp;DSName noprint&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; outest=PE(rename=(read&amp;amp;i=Value));&lt;/DIV&gt;&lt;DIV&gt;model rec = read&amp;amp;i; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;proc append base=AllStats data=pe; run;&lt;/DIV&gt;&lt;DIV&gt;%end;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;options notes;&lt;/DIV&gt;&lt;DIV&gt;%mend;&lt;/DIV&gt;&lt;DIV&gt;%RunReg(sas1, &amp;amp;nCont)&lt;/DIV&gt;</description>
      <pubDate>Sat, 18 Dec 2021 03:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786577#M251163</guid>
      <dc:creator>cindyf</dc:creator>
      <dc:date>2021-12-18T03:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to report p values in multiple logistic regression using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786593#M251175</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/410335"&gt;@cindyf&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried to insert&amp;nbsp;ODS OUTPUT ParameterEstimates=_parm;before logistic statement but the _parm dataset is no generated. Can anyone please help me? thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;%let nCont = 100; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;%macro RunReg(DSName, NumVars);&lt;/DIV&gt;
&lt;DIV&gt;options nonotes; &amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;proc datasets nolist;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; delete AllStats; &amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;%do i = 1 %to &amp;amp;NumVars; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;proc logistic data=&amp;amp;DSName noprint&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; outest=PE(rename=(read&amp;amp;i=Value));&lt;/DIV&gt;
&lt;DIV&gt;model rec = read&amp;amp;i; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp;proc append base=AllStats data=pe; run;&lt;/DIV&gt;
&lt;DIV&gt;%end;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;options notes;&lt;/DIV&gt;
&lt;DIV&gt;%mend;&lt;/DIV&gt;
&lt;DIV&gt;%RunReg(sas1, &amp;amp;nCont)&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please do this. First, run the command &lt;FONT face="courier new,courier"&gt;options mprint;&lt;/FONT&gt; Then, set &amp;amp;nCont=1 (for debugging purposes), add in the ODS OUTPUT statement to the above code, and run the macro again, and then show us the log. We need to see the entire log for this run of the macro, every single line, every single character, with nothing removed. Please format the log properly by copying it as text, and pasting it into the window that appears when you click on the &amp;lt;/&amp;gt; icon (see below).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Insert Log Icon in SAS Communities.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66171iFEC370B1DBF07B28/image-size/large?v=v2&amp;amp;px=999" role="button" title="Insert Log Icon in SAS Communities.png" alt="Insert Log Icon in SAS Communities.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 Dec 2021 16:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786593#M251175</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-18T16:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to report p values in multiple logistic regression using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786642#M251206</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/410335"&gt;@cindyf&lt;/a&gt;&amp;nbsp;and welcome to the SAS Support Communities!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ODS OUTPUT statement doesn't create the _parm dataset because of the NOPRINT option of the PROC LOGISTIC statement. So omit the NOPRINT option and use &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/p1b72ff70v3obrn16aanp1r9q2bu.htm" target="_blank" rel="noopener"&gt;ODS SELECT NONE&lt;/A&gt;&amp;nbsp;instead to suppress the printed output. With the PERSIST=PROC option of the&amp;nbsp;ODS OUTPUT statement you can tell SAS to add new observations to dataset _parm in each iteration of your macro loop. You should also close the PROC DATASETS step with a QUIT statement before subsequent ODS statements. Here's a modified version of your code including these suggestions (highlighted in blue):&lt;/P&gt;
&lt;PRE&gt;%let nCont = 100;
%macro RunReg(DSName, NumVars);
options nonotes;
proc datasets nolist;
  delete AllStats;
&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;quit;

ods select none;
ods output ParameterEstimates(persist=proc)=_parm;&lt;/FONT&gt;&lt;/STRONG&gt;
%do i = 1 %to &amp;amp;NumVars;

  proc logistic data=&amp;amp;DSName &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;/*&lt;/FONT&gt;&lt;/STRONG&gt; noprint &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;*/&lt;/FONT&gt;&lt;/STRONG&gt;
              outest=PE(rename=(read&amp;amp;i=Value));
  model rec = read&amp;amp;i;
  run;

  proc append base=AllStats data=pe;
  run;

%end;
&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;ods select all;&lt;/STRONG&gt;&lt;/FONT&gt;
options notes;
%mend RunReg;
%RunReg(sas1, &amp;amp;nCont)&lt;/PRE&gt;
&lt;P&gt;Having most of the statistics in dataset _parm, you maybe don't need the AllStats dataset anymore, so you could simplify the code considerably.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Dec 2021 12:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786642#M251206</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-12-19T12:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to report p values in multiple logistic regression using macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786659#M251208</link>
      <description>&lt;P&gt;Great job, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt; , you have clearly identified the problem and its solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/410335"&gt;@cindyf&lt;/a&gt; I'd like to offer some advice that I think will help you with similar issues in the future, that will lead to a faster resolution of the problem, or avoiding the problem altogether.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should always be reading the log (see &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 2&lt;/A&gt;). When your code isn't working, you should always be showing us the log for the relevant parts of the code, with nothing chopped out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's what the log says is a similar case (emphasis mine)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="sasLogWarning1_1639922851825" class="sasWarning"&gt;&lt;FONT face="courier new,courier"&gt;WARNING: Output 'parameterestimates' was not created. Make sure that the output object name, label, or path is spelled correctly. &lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;Also, verify that the appropriate procedure options are used to produce the requested output object. For example, &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;verify &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;that the NOPRINT option is not used&lt;/STRONG&gt;&lt;/FONT&gt;.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV class="sasWarning"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasWarning"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also advise an approach to writing macros, a highly recommended approach, in which you first create working valid SAS code without macros, for one or two iterations. Once you have working valid SAS code without macros, then you can turn it into a working macro much more easily. Had you done this, you would have gotten the proper output with your non-macro code, and then no problems in turning it into a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Dec 2021 11:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-report-p-values-in-multiple-logistic-regression-using/m-p/786659#M251208</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-20T11:50:36Z</dc:date>
    </item>
  </channel>
</rss>

