<?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: Converting YYYYMM date type number without changing the value in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-YYYYMM-date-type-number-without-changing-the-value-in/m-p/567794#M159717</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;data test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; length var_date 8;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; length var_num&amp;nbsp; 8;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; format var_date yymmn6.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; var_date='01JUN2019'd;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; var_num =input(put(var_date, yymmn6.), 6.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jun 2019 22:18:35 GMT</pubDate>
    <dc:creator>Shemp</dc:creator>
    <dc:date>2019-06-20T22:18:35Z</dc:date>
    <item>
      <title>Converting YYYYMM date type number without changing the value in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-YYYYMM-date-type-number-without-changing-the-value-in/m-p/567774#M159705</link>
      <description>&lt;P&gt;I have a date column in the format YYYYMM and I want to convert that to a number and not sas date number&lt;/P&gt;&lt;P&gt;Example: Date type 201708 should be converted to number 201708&lt;/P&gt;&lt;P&gt;Is there any way to do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 21:01:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-YYYYMM-date-type-number-without-changing-the-value-in/m-p/567774#M159705</guid>
      <dc:creator>mahi1</dc:creator>
      <dc:date>2019-06-20T21:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Converting YYYYMM date type number without changing the value in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-YYYYMM-date-type-number-without-changing-the-value-in/m-p/567782#M159711</link>
      <description>&lt;P&gt;Is your current value actually numeric with a SAS format such as YYMMN6. or similar assigned?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then in a data step&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; date = year(date)*100+month(date);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; FORMAT date best6.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is one way. But I would strongly recommend not doing this as date values are ever so much more flexible than plain numeric values when dates are involved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your "date" is character then there are more gyrations as you cannot change the type of a variable&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have (rename=(date=datechar);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; date = input(datechar, f6.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; drop datechar;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But again I would suggest actually creating a SAS date value.&lt;/P&gt;
&lt;P&gt;Otherwise we need a better example of your data and what you expect.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 21:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-YYYYMM-date-type-number-without-changing-the-value-in/m-p/567782#M159711</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-20T21:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Converting YYYYMM date type number without changing the value in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-YYYYMM-date-type-number-without-changing-the-value-in/m-p/567794#M159717</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;data test;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; length var_date 8;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; length var_num&amp;nbsp; 8;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; format var_date yymmn6.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; var_date='01JUN2019'd;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; var_num =input(put(var_date, yymmn6.), 6.);&lt;BR /&gt;run;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 22:18:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-YYYYMM-date-type-number-without-changing-the-value-in/m-p/567794#M159717</guid>
      <dc:creator>Shemp</dc:creator>
      <dc:date>2019-06-20T22:18:35Z</dc:date>
    </item>
  </channel>
</rss>

