<?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 Calculation? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/459064#M70197</link>
    <description>&lt;P&gt;Thank you so much for your wonderful help.&amp;nbsp;&amp;nbsp; I combined Novinosrin and Astounding's codes to get it work.&amp;nbsp;&amp;nbsp; Unfortunately,&amp;nbsp; I only could give one solution to one person.&amp;nbsp;&amp;nbsp; Because Novinosin answered the Q first, I give the credit to him.&amp;nbsp;&amp;nbsp; But I am appreciated all of your kind help.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 01 May 2018 19:23:46 GMT</pubDate>
    <dc:creator>ybz12003</dc:creator>
    <dc:date>2018-05-01T19:23:46Z</dc:date>
    <item>
      <title>Date Calculation?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449442#M69653</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a sample dataset shown below.&amp;nbsp;&amp;nbsp; I would like to do the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Change the ProduceDate from Character to Date format as MMDDYYYY (such as 06/04/1963).&lt;/P&gt;
&lt;P&gt;2.&amp;nbsp;Create a new ReceiveDate which is 90 days from ProduceDate.&lt;/P&gt;
&lt;P&gt;3. Create a new ShipDate which is 6 months from ProdeceDate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please advice how to do it, thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test; 
      infile datalines dlm='|'; 
  input ID $10. ProduceDate : $10. State : $10.; 
datalines;                  
100012556 | 19980411 |  GA |   
600012956 | 19850321 |  IA |   
500012586 | 19630604 |  CA |  
500052586 | 19970530 |  TX | 
200052576 | 19990702 |  OH |   
600052577 | 19990806 |  TX |   
900052578 | 19990429 |  NY |  
800012578 | 19980527 |  NV |  
600012878 | 19990911 |  FL | 
300022578 | 19850821 |  PA |   
; 

Proc sort; by ProduceDate; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Mar 2018 18:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449442#M69653</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-03-28T18:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449443#M69654</link>
      <description>&lt;P&gt;something like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test; 
      infile datalines dlm='|'; 
  input ID $10. ProduceDate : $10. State : $10.; 
datalines;                  
100012556 | 19980411 |  GA |   
600012956 | 19850321 |  IA |   
500012586 | 19630604 |  CA |  
500052586 | 19970530 |  TX | 
200052576 | 19990702 |  OH |   
600052577 | 19990806 |  TX |   
900052578 | 19990429 |  NY |  
800012578 | 19980527 |  NV |  
600012878 | 19990911 |  FL | 
300022578 | 19850821 |  PA |   
; 


data want;
set test(rename=ProduceDate=_ProduceDate);
ProduceDate=input(_ProduceDate,yymmdd10.);
ReceiveDate =intnx('days',ProduceDate,90);
ShipDate=intnx('month',ProduceDate,6);
format ProduceDate ReceiveDate ShipDate MMDDYY10.;
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Mar 2018 18:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449443#M69654</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-28T18:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449471#M69655</link>
      <description>&lt;P&gt;ProduceDate looks good.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ReceiveDate looks right, but could easily be simplified:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ReceiveDate = ProduceDate + 90;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ShipDate will revert to the first day of the month.&amp;nbsp; To get 6 months later, while using the same day of the month:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ShipDate = intnx('month', ProduceDate, 6, 'same');&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 19:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449471#M69655</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-28T19:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449490#M69658</link>
      <description>&lt;P&gt;Read the ProduceDate as Date instead of Char. If you need same day 6 months from the ProduceDate then use "SameDay" in INTNX&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test; 
format ProduceDate ShipDate ReceiveDate yymmdd10.;
      infile datalines dlm='|'; 
  input ID $10. ProduceDate : yymmdd8. State : $10.;
 ReceiveDate =intnx('days',ProduceDate,90);
ShipDate=intnx('month',ProduceDate,6,"sameday");
datalines;                  
100012556 | 19980411 |  GA |   
600012956 | 19850321 |  IA |   
500012586 | 19630604 |  CA |  
500052586 | 19970530 |  TX | 
200052576 | 19990702 |  OH |   
600052577 | 19990806 |  TX |   
900052578 | 19990429 |  NY |  
800012578 | 19980527 |  NV |  
600012878 | 19990911 |  FL | 
300022578 | 19850821 |  PA |   
; 
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Mar 2018 20:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449490#M69658</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-28T20:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449511#M69659</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp; has already proposed&amp;nbsp;&lt;SPAN&gt;"SameDay" in INTNX to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;solution.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/67134"&gt;@ybz12003&lt;/a&gt;'s &lt;STRONG&gt;1st&lt;/STRONG&gt; requirement is&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;1. Change the ProduceDate from &lt;U&gt;Character&lt;/U&gt; to Date format as MMDDYYYY&lt;/EM&gt;&lt;/STRONG&gt; probably means his/her real data has a character date&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 21:22:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/449511#M69659</guid>
      <dc:creator>Andygray</dc:creator>
      <dc:date>2018-03-28T21:22:04Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/459064#M70197</link>
      <description>&lt;P&gt;Thank you so much for your wonderful help.&amp;nbsp;&amp;nbsp; I combined Novinosrin and Astounding's codes to get it work.&amp;nbsp;&amp;nbsp; Unfortunately,&amp;nbsp; I only could give one solution to one person.&amp;nbsp;&amp;nbsp; Because Novinosin answered the Q first, I give the credit to him.&amp;nbsp;&amp;nbsp; But I am appreciated all of your kind help.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 19:23:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/459064#M70197</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-05-01T19:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/459066#M70198</link>
      <description>&lt;P&gt;Hi Astounding,&amp;nbsp; your code is easy and quick.&amp;nbsp;&amp;nbsp; Awesome!&lt;/P&gt;</description>
      <pubDate>Tue, 01 May 2018 19:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Date-Calculation/m-p/459066#M70198</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2018-05-01T19:25:36Z</dc:date>
    </item>
  </channel>
</rss>

