<?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: Keep only first/last observation for EACH year of EACH company in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531258#M145388</link>
    <description>This is what I was doing. I was puzzled why it did not work. I don’t even know what changed but after quite a while it started working. Thanks though.</description>
    <pubDate>Wed, 30 Jan 2019 04:41:28 GMT</pubDate>
    <dc:creator>shafayat</dc:creator>
    <dc:date>2019-01-30T04:41:28Z</dc:date>
    <item>
      <title>Keep only first/last observation for EACH year of EACH company</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531230#M145366</link>
      <description>&lt;P&gt;Can anyone please give me some clue how I can keep the last observation of "EACH" year of a specific company in a weekly panel data in order to annualize it?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I create year variable from the date and use last.year command, it only retains the last observation for the company, NOT the last for "EACH" year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried sorting the data by year and then permno instead of by permno and then year, but had no luck; it then keeps only 1 observation from each year and deletes other years' data for other companies.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 02:11:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531230#M145366</guid>
      <dc:creator>shafayat</dc:creator>
      <dc:date>2019-01-30T02:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Keep only first/last observation for EACH year of EACH company</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531238#M145370</link>
      <description>&lt;P&gt;1) Create a year variable&lt;/P&gt;
&lt;P&gt;2) Sort by permno and year&lt;/P&gt;
&lt;P&gt;3) then, in a data step do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data newData;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;set myData; by permno year;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;if first.year or last.year;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 03:06:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531238#M145370</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-01-30T03:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Keep only first/last observation for EACH year of EACH company</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531241#M145373</link>
      <description>&lt;P&gt;You will have to show your work.&amp;nbsp; It is entirely possible that you are using the correct tools, but using them incorrectly.&amp;nbsp; So post the program that isn't working.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 03:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531241#M145373</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-01-30T03:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Keep only first/last observation for EACH year of EACH company</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531258#M145388</link>
      <description>This is what I was doing. I was puzzled why it did not work. I don’t even know what changed but after quite a while it started working. Thanks though.</description>
      <pubDate>Wed, 30 Jan 2019 04:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-only-first-last-observation-for-EACH-year-of-EACH-company/m-p/531258#M145388</guid>
      <dc:creator>shafayat</dc:creator>
      <dc:date>2019-01-30T04:41:28Z</dc:date>
    </item>
  </channel>
</rss>

