<?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 SAS Date MONYY problems in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Date-MONYY-problems/m-p/416037#M12705</link>
    <description>&lt;P&gt;Hi, I have a problem using&amp;nbsp;a&amp;nbsp;&amp;nbsp;date with monyy5 format.&lt;/P&gt;
&lt;P&gt;I created the&amp;nbsp;from a ddmmyy10. using this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FECHA2=put(fecha,monyy7.); /*FECHA2 is the original date variable with ddmmyy10. format*/&lt;BR /&gt;MES=input(fecha2,monyy7.); /*MES is my variable for an only month year date*/&lt;/P&gt;
&lt;P&gt;format MES monyy5.; /*Format for my new date variable*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After that, I have a variable that only has month and year, but my problem is when I want to do a select distinct. For example, for&amp;nbsp;the original date variable has two dates in april: 10/04/2017 and 18/04/2017. The new variable shows apr17 for both obs. When I run a select distinct query, it should appear only 1 obs showing apr17 (the rest of the variables are the same), but this not happens... I think internally SAS&amp;nbsp;keeps the day of the date?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How could I created a date variable that only has month and year? Thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Nov 2017 15:20:23 GMT</pubDate>
    <dc:creator>fri0</dc:creator>
    <dc:date>2017-11-24T15:20:23Z</dc:date>
    <item>
      <title>SAS Date MONYY problems</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Date-MONYY-problems/m-p/416037#M12705</link>
      <description>&lt;P&gt;Hi, I have a problem using&amp;nbsp;a&amp;nbsp;&amp;nbsp;date with monyy5 format.&lt;/P&gt;
&lt;P&gt;I created the&amp;nbsp;from a ddmmyy10. using this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FECHA2=put(fecha,monyy7.); /*FECHA2 is the original date variable with ddmmyy10. format*/&lt;BR /&gt;MES=input(fecha2,monyy7.); /*MES is my variable for an only month year date*/&lt;/P&gt;
&lt;P&gt;format MES monyy5.; /*Format for my new date variable*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After that, I have a variable that only has month and year, but my problem is when I want to do a select distinct. For example, for&amp;nbsp;the original date variable has two dates in april: 10/04/2017 and 18/04/2017. The new variable shows apr17 for both obs. When I run a select distinct query, it should appear only 1 obs showing apr17 (the rest of the variables are the same), but this not happens... I think internally SAS&amp;nbsp;keeps the day of the date?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How could I created a date variable that only has month and year? Thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2017 15:20:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Date-MONYY-problems/m-p/416037#M12705</guid>
      <dc:creator>fri0</dc:creator>
      <dc:date>2017-11-24T15:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date MONYY problems</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Date-MONYY-problems/m-p/416041#M12706</link>
      <description>&lt;P&gt;Yes, so dates are always held in SAS as days since a certain timepoint, regardless of format you apply to the number, you will always have the days since a timepoint number.&amp;nbsp; So you code is effectively:&lt;/P&gt;
&lt;PRE&gt;format fecha monyy5.; &lt;/PRE&gt;
&lt;P&gt;You can put it to character and read it back in as much as you like, its not going to change the underlying number.&amp;nbsp; You cannot have a month/year variable, as dates always need to be full - see above as day is needed.&amp;nbsp; If you need to use only month and year, have two separate variables;&lt;/P&gt;
&lt;PRE&gt;yr=year(fecha);
mnth=month(fecha);&lt;/PRE&gt;
&lt;P&gt;And use those, or just convert to text and group on that:&lt;/P&gt;
&lt;PRE&gt;fecha2=put(fecha,monyy7.);&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Nov 2017 15:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Date-MONYY-problems/m-p/416041#M12706</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-24T15:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Date MONYY problems</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Date-MONYY-problems/m-p/416050#M12707</link>
      <description>Thank you! I will have to change my code.</description>
      <pubDate>Fri, 24 Nov 2017 15:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Date-MONYY-problems/m-p/416050#M12707</guid>
      <dc:creator>fri0</dc:creator>
      <dc:date>2017-11-24T15:49:59Z</dc:date>
    </item>
  </channel>
</rss>

