<?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 Delete n rows before and n nrows after an observation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-n-rows-before-and-n-nrows-after-an-observation/m-p/813929#M321271</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I want to delete the rows that have all "(,)", "(,)", "(,)" (i.e., row 10) and then if that's true, always delete row-4;&amp;nbsp; for example, in the table below, I want to delete row 6-10; 11-15; 16-20; 21-25. Any suggestions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would something like below work?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data final2;set Final; if _1="(, )" and _2="(, )" and _3="(, )" then Delete="Y";run;&lt;BR /&gt;Data final2;&lt;BR /&gt;do i=0,1,2,3,4;&lt;BR /&gt;if delete="Y" then do p=_n_-i;&lt;BR /&gt;set final2 point=p;&lt;BR /&gt;delete;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71587i6869391BBFFE535D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="test.png" alt="test.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2022 02:07:54 GMT</pubDate>
    <dc:creator>Yuna11</dc:creator>
    <dc:date>2022-05-18T02:07:54Z</dc:date>
    <item>
      <title>Delete n rows before and n nrows after an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-n-rows-before-and-n-nrows-after-an-observation/m-p/813929#M321271</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I want to delete the rows that have all "(,)", "(,)", "(,)" (i.e., row 10) and then if that's true, always delete row-4;&amp;nbsp; for example, in the table below, I want to delete row 6-10; 11-15; 16-20; 21-25. Any suggestions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would something like below work?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data final2;set Final; if _1="(, )" and _2="(, )" and _3="(, )" then Delete="Y";run;&lt;BR /&gt;Data final2;&lt;BR /&gt;do i=0,1,2,3,4;&lt;BR /&gt;if delete="Y" then do p=_n_-i;&lt;BR /&gt;set final2 point=p;&lt;BR /&gt;delete;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="test.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71587i6869391BBFFE535D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="test.png" alt="test.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 02:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-n-rows-before-and-n-nrows-after-an-observation/m-p/813929#M321271</guid>
      <dc:creator>Yuna11</dc:creator>
      <dc:date>2022-05-18T02:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Delete n rows before and n nrows after an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-n-rows-before-and-n-nrows-after-an-observation/m-p/813949#M321273</link>
      <description>&lt;P&gt;This looks like a report, not a dataset.&amp;nbsp; Did you create this table (using PROC REPORT, PROC TABULATE, or similar?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's probably a better idea to change the creation of the report, rather than read the report into a dataset and delete rows and then print it out.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 20:40:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-n-rows-before-and-n-nrows-after-an-observation/m-p/813949#M321273</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-17T20:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Delete n rows before and n nrows after an observation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-n-rows-before-and-n-nrows-after-an-observation/m-p/813972#M321278</link>
      <description>Yes, it is a report. Thanks for your suggestion, I will try work on the creation of report then.</description>
      <pubDate>Wed, 18 May 2022 01:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-n-rows-before-and-n-nrows-after-an-observation/m-p/813972#M321278</guid>
      <dc:creator>Yuna11</dc:creator>
      <dc:date>2022-05-18T01:29:13Z</dc:date>
    </item>
  </channel>
</rss>

