<?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 Converting numeric to date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-numeric-to-date/m-p/620154#M182186</link>
    <description>&lt;P&gt;I'm trying to use the intnx function to define someone's end date on a promotional offer. The start date variable that I'm reading is numeric so the calculation works, however it's not reading in the dates how I want to. For example, a value in my start date variable is 201707, which I want to read in as July 2017. However, it's giving me the month equivalent of what that number represents, so 251204 (April 2512). How can i read the number in as the corresponding month?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;set month_calc (keep=campaign_YYYYMM bt_duration vintage);&lt;BR /&gt;campaign_YYYYMM2 = campaign_YYYYMM;&lt;BR /&gt;format campaign_YYYYMM2 yymmn.;&lt;BR /&gt;bt_expiry_month = intnx('month',campaign_YYYYMM2,bt_duration);&lt;BR /&gt;format bt_expiry_month yymmn.;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Jan 2020 13:27:58 GMT</pubDate>
    <dc:creator>Joefrancis99</dc:creator>
    <dc:date>2020-01-27T13:27:58Z</dc:date>
    <item>
      <title>Converting numeric to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-numeric-to-date/m-p/620154#M182186</link>
      <description>&lt;P&gt;I'm trying to use the intnx function to define someone's end date on a promotional offer. The start date variable that I'm reading is numeric so the calculation works, however it's not reading in the dates how I want to. For example, a value in my start date variable is 201707, which I want to read in as July 2017. However, it's giving me the month equivalent of what that number represents, so 251204 (April 2512). How can i read the number in as the corresponding month?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;set month_calc (keep=campaign_YYYYMM bt_duration vintage);&lt;BR /&gt;campaign_YYYYMM2 = campaign_YYYYMM;&lt;BR /&gt;format campaign_YYYYMM2 yymmn.;&lt;BR /&gt;bt_expiry_month = intnx('month',campaign_YYYYMM2,bt_duration);&lt;BR /&gt;format bt_expiry_month yymmn.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 13:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-numeric-to-date/m-p/620154#M182186</guid>
      <dc:creator>Joefrancis99</dc:creator>
      <dc:date>2020-01-27T13:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting numeric to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-numeric-to-date/m-p/620156#M182187</link>
      <description>&lt;P&gt;Convert your numeric yyyymm start_date to a SAS date with format yymmn6. Then you can apply intnx in the way you want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input start_date;
datalines;
201707
;
run;

data want;
set have;
format start_date_as_date end_date yymmn6.;
start_date_as_date = input(put(start_date,z6.),yymmn6.);
end_date = intnx('month',start_date_as_date,1,'s');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So to apply to your example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	set month_calc (keep=campaign_YYYYMM bt_duration vintage);
	format campaign_YYYYMM2 bt_expiry_month yymmn6.;
	campaign_YYYYMM2=input(put(campaign_YYYYMM, z6.), yymmn6.);
	bt_expiry_month=intnx('month', campaign_YYYYMM2, bt_duration, 's');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Jan 2020 13:44:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-numeric-to-date/m-p/620156#M182187</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2020-01-27T13:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Converting numeric to date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-numeric-to-date/m-p/620157#M182188</link>
      <description>&lt;P&gt;Perfect, thanks a lot!&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 13:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-numeric-to-date/m-p/620157#M182188</guid>
      <dc:creator>Joefrancis99</dc:creator>
      <dc:date>2020-01-27T13:56:42Z</dc:date>
    </item>
  </channel>
</rss>

