<?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: ERROR: There were 1 unclosed %DO statements. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/915222#M360635</link>
    <description>&lt;P&gt;In my case, I had closed a %do loop, so I was not able to find out the error. Later I found out with the help of a colleague (Sushil)&amp;nbsp; that it was closed with end (and not %end). So the problem was I was trying to close %do loop with end and not %end, so the error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Dr. Abhijeet Safai&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2024 12:01:35 GMT</pubDate>
    <dc:creator>DrAbhijeetSafai</dc:creator>
    <dc:date>2024-02-09T12:01:35Z</dc:date>
    <item>
      <title>ERROR: There were 1 unclosed %DO statements.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/86167#M18492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The intention of this code to get every permutation of copay onto one line for the 3 by variables listed within the macro.&amp;nbsp; (i.e. SubscriberCopay_Crowns, SpouseCopay_Crowns, etc... for 5 different relationships , for 20 types of services).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've written loops on many occasions but this one in particular is giving me an error as specified in the discussion title.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql; &lt;BR /&gt;&amp;nbsp; select distinct translate(translate(trim(ValidRelationshipDescription),'_','/'),'_',' ') &lt;BR /&gt;&amp;nbsp; into :Relationship1 - :Relationship5 from copay2;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql; &lt;BR /&gt;&amp;nbsp; select distinct _NAME_ into :Service1 - :Service20 from copay3;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro expand;&lt;BR /&gt;data copay4;&lt;BR /&gt;&amp;nbsp; set copay3;&lt;BR /&gt;&amp;nbsp; by Groupnumber NetworkGroupID NetworkGroupIDDescription;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %do i = 1 %to 5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do k = 1 %to 20;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if first.NetworkGroupID %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if _NAME_ = "&amp;amp;&amp;amp;service&amp;amp;k.." %then %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp;Relationship&amp;amp;i.._&amp;amp;&amp;amp;Service&amp;amp;k.. = &amp;amp;&amp;amp;Relationship&amp;amp;i..;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %end;&lt;BR /&gt; %end;&lt;BR /&gt;run;&lt;BR /&gt;%mend expand;&lt;BR /&gt;%expand;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;dataset copay3 example line:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Groupnumber, NetworkGroupID, NetworkGroupIDDescription, _NAME_, Any, Dependants_Only, Subscriber_Spouse, Subscriber_Only, Spouse_Dependants&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;00000-00001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; All Networks&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Crown&amp;nbsp;&amp;nbsp;&amp;nbsp; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 12pt;"&gt;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 17:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/86167#M18492</guid>
      <dc:creator>Data_Detective_23219</dc:creator>
      <dc:date>2013-01-25T17:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: There were 1 unclosed %DO statements.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/86168#M18493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have 4 %do and 3 %end so the error is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to add another %end or remove a %do&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 17:31:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/86168#M18493</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-01-25T17:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: There were 1 unclosed %DO statements.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/86169#M18494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My guess would be that this construct:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if _NAME_ = "&amp;amp;&amp;amp;service&amp;amp;k.." %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp;Relationship&amp;amp;i.._&amp;amp;&amp;amp;Service&amp;amp;k.. = &amp;amp;&amp;amp;Relationship&amp;amp;i..;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;should be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if _NAME_ = "&amp;amp;&amp;amp;service&amp;amp;k.." %then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp;Relationship&amp;amp;i.._&amp;amp;&amp;amp;Service&amp;amp;k.. = &amp;amp;&amp;amp;Relationship&amp;amp;i..;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 18:19:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/86169#M18494</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-01-25T18:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: There were 1 unclosed %DO statements.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/86170#M18495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks ballardw.&amp;nbsp; Your answer was correct.&amp;nbsp; I had a redundant do in my condition.&amp;nbsp; Suprising I can still get completely flummoxed by such trivial errors. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2013 14:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/86170#M18495</guid>
      <dc:creator>Data_Detective_23219</dc:creator>
      <dc:date>2013-01-29T14:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: There were 1 unclosed %DO statements.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/915222#M360635</link>
      <description>&lt;P&gt;In my case, I had closed a %do loop, so I was not able to find out the error. Later I found out with the help of a colleague (Sushil)&amp;nbsp; that it was closed with end (and not %end). So the problem was I was trying to close %do loop with end and not %end, so the error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Dr. Abhijeet Safai&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 12:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/915222#M360635</guid>
      <dc:creator>DrAbhijeetSafai</dc:creator>
      <dc:date>2024-02-09T12:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: There were 1 unclosed %DO statements.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/915257#M360643</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/27897"&gt;@DrAbhijeetSafai&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;In my case, I had closed a %do loop, so I was not able to find out the error. Later I found out with the help of a colleague (Sushil)&amp;nbsp; that it was closed with end (and not %end). So the problem was I was trying to close %do loop with end and not %end, so the error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Dr. Abhijeet Safai&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not really.&lt;/P&gt;
&lt;P&gt;The code you posted has the opposite problem.&amp;nbsp; You are using MACRO code where you need to be using actual SAS code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example these two statements make no sense at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if first.NetworkGroupID %then %do;
%if _NAME_ = "&amp;amp;&amp;amp;service&amp;amp;k.." %then %do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The string &lt;CODE class=" language-sas"&gt;first.NetworkGroupID&lt;/CODE&gt; that you are asking the macro processor to evaluate as a boolean expression is not one.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And no matter what the macro variables resolve to this test&amp;nbsp;&lt;CODE class=" language-sas"&gt;_NAME_ = "&amp;amp;&amp;amp;service&amp;amp;k.."&lt;/CODE&gt;&amp;nbsp;will always be false to the macro processor since the string on the left starts with an underscore and the string on the right starts with a double quote character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to test the value of a variable like&amp;nbsp;&lt;CODE class=" language-sas"&gt;first.NetworkGroupID&lt;/CODE&gt;&amp;nbsp;and&amp;nbsp;&lt;CODE class=" language-sas"&gt;_NAME_&lt;/CODE&gt; then you need to use &lt;STRONG&gt;SAS code&lt;/STRONG&gt; and not &lt;STRONG&gt;MACRO code&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 14:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/915257#M360643</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-02-09T14:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: There were 1 unclosed %DO statements.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/915774#M360815</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; Thanks for your response.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, I have not posted any code. Maybe you wanted to say - The code posted here has opposite problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Dr. Abhijeet Safai&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2024 08:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-There-were-1-unclosed-DO-statements/m-p/915774#M360815</guid>
      <dc:creator>DrAbhijeetSafai</dc:creator>
      <dc:date>2024-02-13T08:36:04Z</dc:date>
    </item>
  </channel>
</rss>

