<?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: Create a MTD flag on SAS EG for a Year over Year analysis in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302059#M20503</link>
    <description>&lt;P&gt;Did you have an "END AS VaraibleName" ?&lt;/P&gt;
&lt;P&gt;need to have a place to put the result&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2016 14:20:12 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-10-03T14:20:12Z</dc:date>
    <item>
      <title>Create a MTD flag on SAS EG for a Year over Year analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302055#M20502</link>
      <description>&lt;P&gt;I am trying to create a MTD flad on SAS EG to compare financial figures year over year; below is the formula I came up with, however I am not getting any answers. Not sure, what I'm doing wrong here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CASE&lt;/P&gt;&lt;P&gt;WHEN MONTH(t1.TransactionDate) = MONTH (TODAY()) AND DAY(t1.TransactionDate) &amp;lt;=&amp;nbsp;DAY(TODAY())&lt;/P&gt;&lt;P&gt;THEN 'MTD'&lt;/P&gt;&lt;P&gt;END&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list of TransactionsDates for 2015 (Jan to Dec) and 2016 YTD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CJ&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 14:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302055#M20502</guid>
      <dc:creator>chrisjab</dc:creator>
      <dc:date>2016-10-03T14:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create a MTD flag on SAS EG for a Year over Year analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302059#M20503</link>
      <description>&lt;P&gt;Did you have an "END AS VaraibleName" ?&lt;/P&gt;
&lt;P&gt;need to have a place to put the result&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 14:20:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302059#M20503</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-03T14:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create a MTD flag on SAS EG for a Year over Year analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302060#M20504</link>
      <description>Yes I do</description>
      <pubDate>Mon, 03 Oct 2016 14:22:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302060#M20504</guid>
      <dc:creator>chrisjab</dc:creator>
      <dc:date>2016-10-03T14:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create a MTD flag on SAS EG for a Year over Year analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302063#M20505</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input transactiondate :yymmdd10.;
format transactiondate yymmddd10.;
cards;
2015-04-04
2015-10-02
2015-10-10
2016-04-04
2016-10-02
2016-10-10
;
run;

proc sql;
create table want as
select transactiondate,
case
when month(t1.TransactionDate) = month(today()) and day(t1.TransactionDate) &amp;lt;= day(today())
then 'MTD'
end as mtd
from have t1;
quit;

proc print noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;delivers this result:&lt;/P&gt;
&lt;PRE&gt;transactiondate    mtd

  2015-04-04          
  2015-10-02       MTD
  2015-10-10          
  2016-04-04          
  2016-10-02       MTD
  2016-10-10          
&lt;/PRE&gt;
&lt;P&gt;So to me, your query works as desired; if that is not the case with your code, post the complete SQL code and the log.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 14:29:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302063#M20505</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-10-03T14:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create a MTD flag on SAS EG for a Year over Year analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302213#M20510</link>
      <description>&lt;P&gt;Is TransactionDate a SAS Date or DateTime value. If it's DateTime then your When case would always be False.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 02:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302213#M20510</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-10-04T02:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create a MTD flag on SAS EG for a Year over Year analysis</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302321#M20514</link>
      <description>&lt;P&gt;Thank you Kurt, the problem was the date format&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 13:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Create-a-MTD-flag-on-SAS-EG-for-a-Year-over-Year-analysis/m-p/302321#M20514</guid>
      <dc:creator>chrisjab</dc:creator>
      <dc:date>2016-10-04T13:03:03Z</dc:date>
    </item>
  </channel>
</rss>

