<?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: Macro error while performing logistic regression of each independent variable against Target var in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/912161#M10710</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; but it is given for linear regression and not for logistic regression. In the comment also complete solution is not given. Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Jan 2024 11:52:06 GMT</pubDate>
    <dc:creator>mohsinm</dc:creator>
    <dc:date>2024-01-19T11:52:06Z</dc:date>
    <item>
      <title>Macro error while performing logistic regression of each independent variable against Target variabl</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/910466#M10689</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list of multiple independent variables. I want to run a logistic regression model of each independent variable against an dependent variable and the same process should be repeated for each independent variable against the same target variable and the output statistics should be saved in a dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS Viya 3.5 version.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, while running the code mentioned in the last, it is showing the following error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: The %DO statement is not valid in open code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ERROR: The %end statement is not valid in open code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there any other way through which I can get the similar output?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let dependent_variable = Cholesterol_Status;&lt;/P&gt;&lt;P&gt;%let independent_variables = AgeAtStart Smoking_Status;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let variable_list = %scan(&amp;amp;independent_variables, 1);&lt;/P&gt;&lt;P&gt;%let i = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%do %while (%length(%scan(&amp;amp;independent_variables, &amp;amp;i)) &amp;gt; 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let current_variable = %scan(&amp;amp;independent_variables, &amp;amp;i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc logistic data=mycaslib.mydata;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; model &amp;amp;dependent_variable = &amp;amp;current_variable;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; score data=mycaslib.mydata out=out_rstore;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let i = %eval(&amp;amp;i + 1);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 15:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/910466#M10689</guid>
      <dc:creator>mohsinm</dc:creator>
      <dc:date>2024-01-04T15:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error while performing logistic regression of each independent variable against Target var</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/910469#M10690</link>
      <description>&lt;P&gt;As the error says, they %DO statement cannot be used in open code, which means outside of a macro definition.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically code like you showed would be inside a macro definition, which starts with a %MACRO statement and ends with a %MEND statement.&amp;nbsp; Do you see those statements in the code you used as an example to write this code?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 15:19:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/910469#M10690</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-01-04T15:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error while performing logistic regression of each independent variable against Target var</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/910475#M10691</link>
      <description>&lt;P&gt;Macros not needed here, please see &lt;A href="https://blogs.sas.com/content/iml/2017/02/13/run-1000-regressions.html#:~:text=One%20way%20to%20run%201000,%2C%20NumVars)%3B%20..." target="_self"&gt;this article&lt;/A&gt; and in particular the section entitled "The BY way for many models". The article also asserts that this is more efficient than doing this via a macro. (And the programming is already done for you)&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 15:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/910475#M10691</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-04T15:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error while performing logistic regression of each independent variable against Target var</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/912161#M10710</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; but it is given for linear regression and not for logistic regression. In the comment also complete solution is not given. Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 11:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/912161#M10710</guid>
      <dc:creator>mohsinm</dc:creator>
      <dc:date>2024-01-19T11:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro error while performing logistic regression of each independent variable against Target var</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/912162#M10711</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461071"&gt;@mohsinm&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; but it is given for linear regression and not for logistic regression.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/461071"&gt;@mohsinm&lt;/a&gt;&amp;nbsp;&amp;nbsp;Yes, you have to replace the PROC REG code with the desired PROC LOGISTIC code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;In the comment also complete solution is not given.&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know why you say it is not complete. It looks complete to me. What is missing?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 13:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Macro-error-while-performing-logistic-regression-of-each/m-p/912162#M10711</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-19T13:05:44Z</dc:date>
    </item>
  </channel>
</rss>

