<?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: Date format from Day to MonYy in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389419#M25124</link>
    <description>&lt;P&gt;Thanks Astounding, much appreciated !&lt;/P&gt;</description>
    <pubDate>Sun, 20 Aug 2017 22:22:20 GMT</pubDate>
    <dc:creator>OscarBoots1</dc:creator>
    <dc:date>2017-08-20T22:22:20Z</dc:date>
    <item>
      <title>Date format from Day to MonYy</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389384#M25120</link>
      <description>&lt;P&gt;Hi Forum,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to get&amp;nbsp;all of the dates in a given month by joining 2 tables together on their 'MonYr' field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table A&amp;nbsp;has a 'RptDate' field&amp;nbsp;value&amp;nbsp;of '16AUG17' format DATE7. and a 'MonYr' field&amp;nbsp;derived from the RptDate field by changing the format to 'MONYY5.' so the 'MonYr' value is 'AUG17'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table B&amp;nbsp;also has a 'RptDate' field for all Dates in 2017&amp;nbsp;and a 'MonYr' field&amp;nbsp;also derived from the RptDate field by changing the format to 'MONYY5.'&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the below statement, I only get the result for&amp;nbsp;'16AUG17' instead of all dates in AUG17.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this is due to my creation of the MonYr field by changing the 'RptDate' format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone advise a solution to this?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SELECT 
RptDate 
FROM Table1 A
INNER JOIN Table2 B
ON A. MonYr = B. MonYr &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 20 Aug 2017 08:04:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389384#M25120</guid>
      <dc:creator>OscarBoots1</dc:creator>
      <dc:date>2017-08-20T08:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Date format from Day to MonYy</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389385#M25121</link>
      <description>&lt;P&gt;I definitely agree with your reason, it is because of the monyr variable that you derived using the format monyy5. with this approach the appearnce of the variable monyr alone is changing but internally the monyr has the full numeric date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To overcome this issue, please derive the monyr variable with put function something like below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;monyr=put(rptdate,monyy5.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this will derive the character monyr variable and on this variable if you merge you will get the expected output. Please derive the same in both the datasets you are merging.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this informtion will help you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2017 08:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389385#M25121</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-08-20T08:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Date format from Day to MonYy</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389390#M25122</link>
      <description>&lt;P&gt;Worth a try, but needs to be tested to see if it actually works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;on put(a.rptdate, monyy5.) = put(b.rptdate, monyy5.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it works, you don't need to create any new variables (not even MonYr).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact, it looks like you aren't selecting any variables from B. &amp;nbsp;So it would probably be faster (and might work if the above doesn't work) to switch to a subquery:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Select RptDate from A&lt;/P&gt;
&lt;P&gt;where put(RptDate, monyy5.) in&lt;/P&gt;
&lt;P&gt;(select distinct put(RptDate, monyy5.) from B)&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2017 13:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389390#M25122</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-20T13:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Date format from Day to MonYy</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389418#M25123</link>
      <description>&lt;P&gt;Thanks Jag, works perfectly.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2017 22:21:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389418#M25123</guid>
      <dc:creator>OscarBoots1</dc:creator>
      <dc:date>2017-08-20T22:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Date format from Day to MonYy</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389419#M25124</link>
      <description>&lt;P&gt;Thanks Astounding, much appreciated !&lt;/P&gt;</description>
      <pubDate>Sun, 20 Aug 2017 22:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Date-format-from-Day-to-MonYy/m-p/389419#M25124</guid>
      <dc:creator>OscarBoots1</dc:creator>
      <dc:date>2017-08-20T22:22:20Z</dc:date>
    </item>
  </channel>
</rss>

