<?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 keeping first 5 rows of the data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179882#M265016</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i want o keep first 5 lines of the data and delete everything else. how may i do so using the data want; set have; run; ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;many thanks,&lt;/P&gt;&lt;P&gt;aaron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Feb 2015 14:04:30 GMT</pubDate>
    <dc:creator>aarony</dc:creator>
    <dc:date>2015-02-24T14:04:30Z</dc:date>
    <item>
      <title>keeping first 5 rows of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179882#M265016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i want o keep first 5 lines of the data and delete everything else. how may i do so using the data want; set have; run; ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;many thanks,&lt;/P&gt;&lt;P&gt;aaron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 14:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179882#M265016</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2015-02-24T14:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: keeping fist 5 rows of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179883#M265017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aaron,&lt;/P&gt;&lt;P&gt;you can use the _N_ variable. This variable is the row nuber that appears at the left in the dataset visualisation. To keep the first 5 only must do&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;if _N_&amp;lt;=5;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Keep in mind that a where doesn't work with _N_.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 14:24:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179883#M265017</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2015-02-24T14:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: keeping fist 5 rows of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179884#M265018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While you already have the correct answer, but as they always say, SAS has 6 solutions for every problem &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To avoid read in all of the data, you could do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Stop reading when it is time,&lt;/P&gt;&lt;P&gt;Date want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if _n_ &amp;gt;5 then stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;2. Just bring in 5:&lt;/P&gt;&lt;P&gt;Date want;&lt;/P&gt;&lt;P&gt;set have (obs=5);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck with your homework,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 15:01:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179884#M265018</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-02-24T15:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: keeping fist 5 rows of the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179885#M265019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so so much both!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 15:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keeping-first-5-rows-of-the-data/m-p/179885#M265019</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2015-02-24T15:06:12Z</dc:date>
    </item>
  </channel>
</rss>

