<?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: Do/Select statement not working when formatting dates. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764332#M242087</link>
    <description>&lt;P&gt;ELSE can only be used as the second branch of an IF statement.&lt;/P&gt;
&lt;P&gt;To me it seems your code misses&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if /* condition */
then do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;before&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;incmonthid = YEAR(disdt_c)*100+MONTH(disdt_c)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 26 Aug 2021 20:17:43 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-08-26T20:17:43Z</dc:date>
    <item>
      <title>Do/Select statement not working when formatting dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764323#M242083</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;I'm receiving the following error for the code above:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;31         	format incdt mmddyy10.;
32         		incmonthid = YEAR(disdt_c)*100+MONTH(disdt_c);
33         		yr = YEAR(disdt_c);
34         	end;
            ___
            161
35             else do;
               ____
               160
ERROR 161-185: No matching DO/SELECT statement.

ERROR 160-185: No matching IF-THEN clause.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Not sure what the issue is.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 20:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764323#M242083</guid>
      <dc:creator>bknitch</dc:creator>
      <dc:date>2021-08-26T20:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Do/Select statement not working when formatting dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764326#M242085</link>
      <description>&lt;P&gt;What it says. A END ends a block that starts either with DO or SELECT.&lt;/P&gt;
&lt;P&gt;Please post your complete data step code so we can correct it.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 20:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764326#M242085</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-26T20:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Do/Select statement not working when formatting dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764327#M242086</link>
      <description>I've edited the post to reflect the entire code</description>
      <pubDate>Thu, 26 Aug 2021 20:09:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764327#M242086</guid>
      <dc:creator>bknitch</dc:creator>
      <dc:date>2021-08-26T20:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Do/Select statement not working when formatting dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764332#M242087</link>
      <description>&lt;P&gt;ELSE can only be used as the second branch of an IF statement.&lt;/P&gt;
&lt;P&gt;To me it seems your code misses&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if /* condition */
then do;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;before&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;incmonthid = YEAR(disdt_c)*100+MONTH(disdt_c)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Aug 2021 20:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764332#M242087</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-26T20:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Do/Select statement not working when formatting dates.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764337#M242091</link>
      <description>@kurtbrmser this actually was the solution! Thank you i just placed it in the incorrect spot.</description>
      <pubDate>Thu, 26 Aug 2021 20:36:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-Select-statement-not-working-when-formatting-dates/m-p/764337#M242091</guid>
      <dc:creator>bknitch</dc:creator>
      <dc:date>2021-08-26T20:36:29Z</dc:date>
    </item>
  </channel>
</rss>

