<?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 include a global variable in a do while loop in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579124#M13402</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have macro that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;%let var = 1;&lt;/P&gt;&lt;P&gt;%do %while (input("&amp;amp;var".,8.) &amp;gt; 0);&lt;/P&gt;&lt;P&gt;blablabla&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the sas log outputs&amp;nbsp; required operator not found in expression&amp;nbsp;input("&amp;amp;var".,8.) &amp;gt; 0&lt;BR /&gt;I would love some help to debug this... thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2019 13:39:07 GMT</pubDate>
    <dc:creator>laiguanyu001</dc:creator>
    <dc:date>2019-08-05T13:39:07Z</dc:date>
    <item>
      <title>include a global variable in a do while loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579124#M13402</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have macro that looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;%let var = 1;&lt;/P&gt;&lt;P&gt;%do %while (input("&amp;amp;var".,8.) &amp;gt; 0);&lt;/P&gt;&lt;P&gt;blablabla&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the sas log outputs&amp;nbsp; required operator not found in expression&amp;nbsp;input("&amp;amp;var".,8.) &amp;gt; 0&lt;BR /&gt;I would love some help to debug this... thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 13:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579124#M13402</guid>
      <dc:creator>laiguanyu001</dc:creator>
      <dc:date>2019-08-05T13:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: include a global variable in a do while loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579126#M13403</link>
      <description>&lt;P&gt;I am guessing you meant to include the period &lt;U&gt;inside the double quotes&lt;/U&gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do %while (input("&amp;amp;var.", 8.) &amp;gt; 0);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Aug 2019 13:42:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579126#M13403</guid>
      <dc:creator>aaronh</dc:creator>
      <dc:date>2019-08-05T13:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: include a global variable in a do while loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579127#M13404</link>
      <description>&lt;P&gt;Why are you comparing the letters inp... to the digit 0?&lt;/P&gt;
&lt;P&gt;Don't you want the macro processor to compare the digit 1 to the digit 0?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do %while (&amp;amp;var &amp;gt; 0);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that if VAR can take on non integer values in your loop then you will need to use %SYSEVALF() to allow comparison of strings that look like floating point numbers.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do %while (%sysevalf(&amp;amp;var &amp;gt; 0));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Aug 2019 13:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579127#M13404</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-05T13:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: include a global variable in a do while loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579128#M13405</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/279765"&gt;@laiguanyu001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have macro that looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro test;&lt;/P&gt;
&lt;P&gt;%let var = 1;&lt;/P&gt;
&lt;P&gt;%do %while (input("&amp;amp;var".,8.) &amp;gt; 0);&lt;/P&gt;
&lt;P&gt;blablabla&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the sas log outputs&amp;nbsp; required operator not found in expression&amp;nbsp;input("&amp;amp;var".,8.) &amp;gt; 0&lt;BR /&gt;I would love some help to debug this... thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't see why you say &amp;amp;VAR is a global variable, as it is defined inside of %MACRO TEST&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But anyway, %DO %WHILE() requires a macro variable or macro function inside the parenthesis. INPUT is not a macro function, that why you are getting the operator not found error. It's not even clear why you are using INPUT here, as you can test &amp;amp;VAR &amp;gt; 0 without the INPUT function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do %while (&amp;amp;var&amp;gt;0);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 14:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579128#M13405</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-05T14:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: include a global variable in a do while loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579129#M13406</link>
      <description>&lt;P&gt;In the macro-language everything is text, except for expressions, so you can just write&lt;/P&gt;
&lt;PRE&gt;%do %while (&amp;amp;var. &amp;gt; 0);&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Aug 2019 13:47:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579129#M13406</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-08-05T13:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: include a global variable in a do while loop</title>
      <link>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579130#M13407</link>
      <description>&lt;P&gt;A few basic errors need to be fixed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro language does not support the INPUT function.&amp;nbsp; You need to use the INPUTN function instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To use DATA step functions in a macro language expression, you need to call the function use %SYSFUNC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro language does not use quotes to identify strings.&amp;nbsp; Get rid of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Incorporating all the changes:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;

%let var = 1;

%do %while (%sysfunc(inputn(&amp;amp;var.,8.)) &amp;gt; 0);

blablabla

%end;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, once you make those changes to correct the syntax, your loop will be an infinite loop.&amp;nbsp; There better be some logic inside the loop that changes the %DO %WHILE condition from being true to being false.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 13:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/include-a-global-variable-in-a-do-while-loop/m-p/579130#M13407</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-08-05T13:47:44Z</dc:date>
    </item>
  </channel>
</rss>

