<?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 do i keep the latest date possible of that year. (rows) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191146#M48144</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry i should have been more specific&lt;/P&gt;&lt;P&gt;i have company names as well for this.&lt;/P&gt;&lt;P&gt;so basically&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;datadate&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;20040101&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;20040102&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;and so on until 20131231.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;for companies a to z.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;i want to keep the last date of each year for each company.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;how may i tackle this issue? thank you in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Apr 2014 01:21:13 GMT</pubDate>
    <dc:creator>aarony</dc:creator>
    <dc:date>2014-04-24T01:21:13Z</dc:date>
    <item>
      <title>how do i keep the latest date possible of that year. (rows)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191144#M48142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i have &lt;/P&gt;&lt;P&gt;datadate&lt;/P&gt;&lt;P&gt;20040101&lt;/P&gt;&lt;P&gt;20040102&lt;/P&gt;&lt;P&gt;and so on until 20131231.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I basically wan to keep rows with the last date of the year, for each year &lt;/P&gt;&lt;P&gt;there are some caveats:&lt;/P&gt;&lt;P&gt;some years last day with the data might be 20131229 for example not 20131231.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i wan to end up with &lt;/P&gt;&lt;P&gt;20041231&lt;/P&gt;&lt;P&gt;20051231&lt;/P&gt;&lt;P&gt;20061231 and so on and if 31st is not observable the latest date possible of that year.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 00:46:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191144#M48142</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2014-04-24T00:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: how do i keep the latest date possible of that year. (rows)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191145#M48143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input date yymmdd8.;&lt;/P&gt;&lt;P&gt;format date yymmddn8.;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;20040102&lt;/P&gt;&lt;P&gt;20040312&lt;/P&gt;&lt;P&gt;20040616&lt;/P&gt;&lt;P&gt;20041231&lt;/P&gt;&lt;P&gt;20060419&lt;/P&gt;&lt;P&gt;20061229&lt;/P&gt;&lt;P&gt;20080223&lt;/P&gt;&lt;P&gt;20081231&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select max(date) as date format=yymmddn8. from have group by year(date);&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 01:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191145#M48143</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2014-04-24T01:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: how do i keep the latest date possible of that year. (rows)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191146#M48144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sorry i should have been more specific&lt;/P&gt;&lt;P&gt;i have company names as well for this.&lt;/P&gt;&lt;P&gt;so basically&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;datadate&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;20040101&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;20040102&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;and so on until 20131231.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;for companies a to z.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;i want to keep the last date of each year for each company.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;how may i tackle this issue? thank you in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 01:21:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191146#M48144</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2014-04-24T01:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: how do i keep the latest date possible of that year. (rows)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191147#M48145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. convert your field to an actual date field, slchen has posted a method for this above. &lt;/P&gt;&lt;P&gt;2. Create a year variable&lt;/P&gt;&lt;P&gt;3. Sort by Date/Year&lt;/P&gt;&lt;P&gt;4. Use last. processing to get the last one. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data part1;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;date_var=input(year, yymmdd8.);&lt;/P&gt;&lt;P&gt;format date_var date9.;&lt;/P&gt;&lt;P&gt;year=year(date_var);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data= part1;&lt;/P&gt;&lt;P&gt;by company year date;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;by company year;&lt;/P&gt;&lt;P&gt;if last.year;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 01:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191147#M48145</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-04-24T01:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: how do i keep the latest date possible of that year. (rows)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191148#M48146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you are a magician reeza. thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 02:32:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191148#M48146</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2014-04-24T02:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: how do i keep the latest date possible of that year. (rows)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191149#M48147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data have;
input date yymmdd8.;
format date yymmddn8.;
cards;
20040102
20040312
20040616
20041231
20060419
20061229
20080223
20081231
;
run;
 data last;
&amp;nbsp; set have;
&amp;nbsp; if date=mdy(1,1,year(date)+1)-1;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 03:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-do-i-keep-the-latest-date-possible-of-that-year-rows/m-p/191149#M48147</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-04-24T03:28:56Z</dc:date>
    </item>
  </channel>
</rss>

