<?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: How to create a complete date values from partially provided dates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-complete-date-values-from-partially-provided/m-p/286471#M58753</link>
    <description>&lt;P&gt;Here's one way for character values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
   set have;
   /* assumes your "date" is CHARACTER*/
   Enddate = input(date,anydtdte32.);
   /* missing is because year provides insufficient information to anydtdte*/
   /* so assign last day of dec as day and month*/
   if missing(enddate) then enddate = mdy(12,31,input(date,best4.));
   /* anydtdte when day of month is missing assigns day to be 1, this is 
   one way to advance to last day of current month */
   if length(date)=7 then enddate=intnx('month',enddate,1)-1;
   format enddate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Jul 2016 19:58:12 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-07-22T19:58:12Z</dc:date>
    <item>
      <title>How to create a complete date values from partially provided dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-complete-date-values-from-partially-provided/m-p/286458#M58746</link>
      <description>&lt;P&gt;Dear,&lt;/P&gt;&lt;P&gt;I need create a an ENDDATE variable from date variable values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If complete date is provided then the date will be the end date.&lt;/P&gt;&lt;P&gt;If Month provided then last day of the month will be the ENDDATE value.&lt;BR /&gt;If year only provided then last day of the year will be the ENDDATE value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id &amp;nbsp; &amp;nbsp; date&lt;BR /&gt;1 &amp;nbsp; &amp;nbsp; 2015-01-06&lt;BR /&gt;2 &amp;nbsp; &amp;nbsp; 2015-11&lt;BR /&gt;3 &amp;nbsp; &amp;nbsp; 2015&lt;BR /&gt;4 &amp;nbsp; &amp;nbsp; 2015-02&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Output needed:&lt;/P&gt;&lt;P&gt;ENDDATE&lt;/P&gt;&lt;P&gt;06JAN2015&lt;BR /&gt;30NOV2015&lt;BR /&gt;31DEC2015&lt;BR /&gt;28FEB2015&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 18:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-complete-date-values-from-partially-provided/m-p/286458#M58746</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2016-07-22T18:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a complete date values from partially provided dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-complete-date-values-from-partially-provided/m-p/286462#M58748</link>
      <description>&lt;P&gt;Generate a valid SAS date and then use SAS function &lt;STRONG&gt;intnx()&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;enddate = intnx("MONTH", date, 0, "END");&lt;/P&gt;
&lt;P&gt;/* or */&lt;/P&gt;
&lt;P&gt;enddate =&amp;nbsp;&lt;SPAN&gt;intnx('YEAR", date, 0, "END");&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 19:08:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-complete-date-values-from-partially-provided/m-p/286462#M58748</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-22T19:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a complete date values from partially provided dates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-complete-date-values-from-partially-provided/m-p/286471#M58753</link>
      <description>&lt;P&gt;Here's one way for character values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
   set have;
   /* assumes your "date" is CHARACTER*/
   Enddate = input(date,anydtdte32.);
   /* missing is because year provides insufficient information to anydtdte*/
   /* so assign last day of dec as day and month*/
   if missing(enddate) then enddate = mdy(12,31,input(date,best4.));
   /* anydtdte when day of month is missing assigns day to be 1, this is 
   one way to advance to last day of current month */
   if length(date)=7 then enddate=intnx('month',enddate,1)-1;
   format enddate date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jul 2016 19:58:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-complete-date-values-from-partially-provided/m-p/286471#M58753</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-22T19:58:12Z</dc:date>
    </item>
  </channel>
</rss>

