<?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: select particular rows based on condition in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292123#M19935</link>
    <description>&lt;P&gt;Well, if I understand your request correctly:&lt;/P&gt;
&lt;PRE&gt;data person;
input spool $ batch $ number;
datalines;
su r1234 1
su r1234 2
su r1234 3
Su r1234 4
su r1234 5
1 r1234 6
1 r1234 7
1 r1234 8
2 r1234 9
2 r1234 10
su r1234 11
su r1234 12
su r1234 13
su r1234 14
3 r1234 15
3 r1234 16
3 r1234 17
su r1235 18
su r1235 19
su r1235 20
su r1235 21
Su r1235 22
Su r1235 23
su r1235 24
1 r1235 25
2 r1235 26
2 r1235 27
;
run;

data want;
  set person;
  if upcase(spool)="SU" and upcase(lag1(spool))="SU" and upcase(lag2(spool))="SU" and
      upcase(lag3(spool))="SU" then output;
run;&lt;/PRE&gt;
&lt;P&gt;Do note, there is nothing stopping you sorting the data, and then sorting back using the original sort - you should keep that time data in the dataset so you can sort as much as you like. &amp;nbsp;Also, to get original ordering, you could just set a variable n=_n_; then sort back by n (_n_ is an automatic variable for logical observation position).&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Aug 2016 11:12:50 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-08-17T11:12:50Z</dc:date>
    <item>
      <title>select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292121#M19934</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;this is first time I am posting so any mistake please forgive.&lt;/P&gt;&lt;P&gt;ok so I have data like below;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; person;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;input&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt; spool $ batch $ number;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;datalines&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;su r1234 1&lt;/P&gt;&lt;P&gt;su r1234 2&lt;/P&gt;&lt;P&gt;su r1234 3&lt;/P&gt;&lt;P&gt;Su r1234 4&lt;/P&gt;&lt;P&gt;su r1234 5&lt;/P&gt;&lt;P&gt;1 r1234 6&lt;/P&gt;&lt;P&gt;1 r1234 7&lt;/P&gt;&lt;P&gt;1 r1234 8&lt;/P&gt;&lt;P&gt;2 r1234 9&lt;/P&gt;&lt;P&gt;2 r1234 10&lt;/P&gt;&lt;P&gt;su r1234 11&lt;/P&gt;&lt;P&gt;su r1234 12&lt;/P&gt;&lt;P&gt;su r1234 13&lt;/P&gt;&lt;P&gt;su r1234 14&lt;/P&gt;&lt;P&gt;3 r1234 15&lt;/P&gt;&lt;P&gt;3 r1234 16&lt;/P&gt;&lt;P&gt;3 r1234 17&lt;/P&gt;&lt;P&gt;su r1235 18&lt;/P&gt;&lt;P&gt;su r1235 19&lt;/P&gt;&lt;P&gt;su r1235 20&lt;/P&gt;&lt;P&gt;su r1235 21&lt;/P&gt;&lt;P&gt;Su r1235 22&lt;/P&gt;&lt;P&gt;Su r1235 23&lt;/P&gt;&lt;P&gt;su r1235 24&lt;/P&gt;&lt;P&gt;1 r1235 25&lt;/P&gt;&lt;P&gt;2 r1235 26&lt;/P&gt;&lt;P&gt;2 r1235 27&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I want to select only last four observation where spool is equal to su or SU where this more than four in sequence&amp;nbsp;and it can be more than one sequence of that in same batch and in sequence can be less than four if it is the case then only select that dont want to include number.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I can not sort data on spool as they are timely mannered result.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;how I do it in Enterprise guide or in SAS base.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 11:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292121#M19934</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-17T11:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292123#M19935</link>
      <description>&lt;P&gt;Well, if I understand your request correctly:&lt;/P&gt;
&lt;PRE&gt;data person;
input spool $ batch $ number;
datalines;
su r1234 1
su r1234 2
su r1234 3
Su r1234 4
su r1234 5
1 r1234 6
1 r1234 7
1 r1234 8
2 r1234 9
2 r1234 10
su r1234 11
su r1234 12
su r1234 13
su r1234 14
3 r1234 15
3 r1234 16
3 r1234 17
su r1235 18
su r1235 19
su r1235 20
su r1235 21
Su r1235 22
Su r1235 23
su r1235 24
1 r1235 25
2 r1235 26
2 r1235 27
;
run;

data want;
  set person;
  if upcase(spool)="SU" and upcase(lag1(spool))="SU" and upcase(lag2(spool))="SU" and
      upcase(lag3(spool))="SU" then output;
run;&lt;/PRE&gt;
&lt;P&gt;Do note, there is nothing stopping you sorting the data, and then sorting back using the original sort - you should keep that time data in the dataset so you can sort as much as you like. &amp;nbsp;Also, to get original ordering, you could just set a variable n=_n_; then sort back by n (_n_ is an automatic variable for logical observation position).&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 11:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292123#M19935</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-17T11:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292132#M19936</link>
      <description>&lt;PRE&gt;
You didn't post output yet ?
What if there are only four ,three or two SU ,you want delete them ?


data have;
input spool $ batch $ number;
spool=upcase(spool);
datalines;
su r1234 1
su r1234 2
su r1234 3
Su r1234 4
su r1234 5
1 r1234 6
1 r1234 7
1 r1234 8
2 r1234 9
2 r1234 10
su r1234 11
su r1234 12
su r1234 13
su r1234 14
3 r1234 15
3 r1234 16
3 r1234 17
su r1235 18
su r1235 19
su r1235 20
su r1235 21
Su r1235 22
Su r1235 23
su r1235 24
1 r1235 25
2 r1235 26
2 r1235 27
;
run;
data want;
do i=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
end;

 if spool='SU' then isSU=1;
 
do j=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
 if i gt 4 and isSU then do;
  if j=i-3 or j=i-2 or j=i-1 or j=i then output;
 end;
end;
 drop i j isSU;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2016 11:48:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292132#M19936</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-17T11:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292134#M19937</link>
      <description>&lt;PRE&gt;
You didn't post output yet ?
What if there are only four ,three or two SU ,you want delete them ?


data have;
input spool $ batch $ number;
spool=upcase(spool);
datalines;
su r1234 1
su r1234 2
su r1234 3
Su r1234 4
su r1234 5
1 r1234 6
1 r1234 7
1 r1234 8
2 r1234 9
2 r1234 10
su r1234 11
su r1234 12
su r1234 13
su r1234 14
3 r1234 15
3 r1234 16
3 r1234 17
su r1235 18
su r1235 19
su r1235 20
su r1235 21
Su r1235 22
Su r1235 23
su r1235 24
1 r1235 25
2 r1235 26
2 r1235 27
;
run;
data want;
do i=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
end;

 if spool='SU' then isSU=1;
 
do j=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
 if i gt 4 and isSU then do;
  if j=i-3 or j=i-2 or j=i-1 or j=i then output;
 end;
end;
 drop i j isSU;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2016 11:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292134#M19937</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-17T11:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292137#M19938</link>
      <description>&lt;P&gt;so basically i want output without row 1,18,19,20.&lt;/P&gt;&lt;P&gt;&amp;nbsp;and in my data there is quite lot observation with SU or su value and I want to keep last four just before any numbered value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 12:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292137#M19938</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-17T12:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292161#M19939</link>
      <description>&lt;PRE&gt;
OK. Just need a little change .




data have;
input spool $ batch $ number;
spool=upcase(spool);
datalines;
su r1234 1
su r1234 2
su r1234 3
Su r1234 4
su r1234 5
1 r1234 6
1 r1234 7
1 r1234 8
2 r1234 9
2 r1234 10
su r1234 11
su r1234 12
su r1234 13
su r1234 14
3 r1234 15
3 r1234 16
3 r1234 17
su r1235 18
su r1235 19
su r1235 20
su r1235 21
Su r1235 22
Su r1235 23
su r1235 24
1 r1235 25
2 r1235 26
2 r1235 27
;
run;
data want;
do i=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
end;

 if spool='SU' then isSU=1;
 
do j=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
 if i gt 4 and isSU then do;
  if j=i-3 or j=i-2 or j=i-1 or j=i then output;
 end;
 else output;
end;
 drop i j isSU;
run;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2016 13:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292161#M19939</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-17T13:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292165#M19940</link>
      <description>&lt;P&gt;great worked thank you so much ksharp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 13:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292165#M19940</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-17T13:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292169#M19941</link>
      <description>&lt;P&gt;Can I ask something as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How you rename the only SU which are present in middle of batch not the beginning of the batch?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 13:25:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292169#M19941</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-17T13:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292331#M19958</link>
      <description>&lt;PRE&gt;
?? I can't understand what you mean. Can you give us an example to explain it ?
You also want know if SU is included in variable Like: 'xxxSuxxxx' ? FIND() and do that.

if find(variable,'su','i') then .........


&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Aug 2016 02:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292331#M19958</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-18T02:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292375#M19960</link>
      <description>&lt;P&gt;SO OUTPUT WOULD LIKE THIS&lt;/P&gt;&lt;P&gt;Only want to change the value for SU which comes before any number other than 1&lt;BR /&gt;SU&amp;nbsp; r1234 2&lt;BR /&gt;SU&amp;nbsp;r1234 3&lt;BR /&gt;Su r1234 4&lt;BR /&gt;SU&amp;nbsp;r1234 5&lt;BR /&gt;1 r1234 6&lt;BR /&gt;1 r1234 7&lt;BR /&gt;1 r1234 8&lt;BR /&gt;2 r1234 9&lt;BR /&gt;2 r1234 10&lt;BR /&gt;IBSU&amp;nbsp;r1234 11&lt;BR /&gt;IBSU&amp;nbsp;r1234 12&lt;BR /&gt;IBSU&amp;nbsp;r1234 13&lt;BR /&gt;IBSU&amp;nbsp;r1234 14&lt;BR /&gt;3 r1234 15&lt;BR /&gt;3 r1234 16&lt;BR /&gt;3 r1234 17&lt;BR /&gt;SU&amp;nbsp;r1235 21&lt;BR /&gt;SU&amp;nbsp;r1235 22&lt;BR /&gt;Su r1235 23&lt;BR /&gt;SU&amp;nbsp;r1235 24&lt;BR /&gt;1 r1235 25&lt;BR /&gt;2 r1235 26&lt;BR /&gt;2 r1235 27&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 07:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292375#M19960</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-18T07:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292381#M19962</link>
      <description>&lt;PRE&gt;
You want set SPOOL value back as what it is ? Make a copy variable and keep it in the final dataset.
Where is IBSU coming from ?


data have;
input spool $ batch $ number;
copy_spool=spool;
spool=upcase(spool);
datalines;
..............
&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Aug 2016 08:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292381#M19962</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-18T08:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292382#M19963</link>
      <description>&lt;P&gt;I want to replace SU to IBSU but only that SU which inbetween batch not in the beginning of new batch&amp;nbsp; does it make sense?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 08:46:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292382#M19963</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-18T08:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292394#M19964</link>
      <description>&lt;PRE&gt;
OK. It is not a big deal.




data have;
input spool $ batch $ number;
spool=upcase(spool);
datalines;
su r1234 1
su r1234 2
su r1234 3
Su r1234 4
su r1234 5
1 r1234 6
1 r1234 7
1 r1234 8
2 r1234 9
2 r1234 10
su r1234 11
su r1234 12
su r1234 13
su r1234 14
3 r1234 15
3 r1234 16
3 r1234 17
su r1235 18
su r1235 19
su r1235 20
su r1235 21
Su r1235 22
Su r1235 23
su r1235 24
1 r1235 25
2 r1235 26
2 r1235 27
;
run;
data temp1;
do i=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
end;

 if spool='SU' then do;isSU=1;count+1;end;
 
do j=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
 if i gt 4 and isSU then do;
  if j=i-3 or j=i-2 or j=i-1 or j=i then output;
 end;
 else output;
end;
 drop i j isSU;
run;
proc sql;
create table temp2 as
 select *,max(count) as max_count from temp1;
quit;
data want;
 set temp2;
 if spool='SU' and (count ne 1 and count ne max_count) then spool='IBSU';
 drop count max_count;
run;

&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Aug 2016 09:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292394#M19964</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-18T09:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292439#M19970</link>
      <description>&lt;P&gt;No I doesn't work as when you add more data as we have then it also converts the SU to IBSU which are present before 1&amp;nbsp;for&amp;nbsp;&amp;nbsp;new batch.if you see in data there is two diffrent batch and for each batch i have first four SU and then 1,2 and so on and sometime in between number as well but I dont want to change su which are present first four for each batch.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2016 13:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292439#M19970</guid>
      <dc:creator>dpa</dc:creator>
      <dc:date>2016-08-18T13:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292623#M19992</link>
      <description>&lt;PRE&gt;
Opps. I missed the group variable BATCH .
This ought to be right.




data have;
input spool $ batch $ number;
spool=upcase(spool);
datalines;
1 r1234 6
1 r1234 7
1 r1234 8
su r1234 1
su r1234 2
su r1234 3
Su r1234 4
su r1234 5
1 r1234 6
1 r1234 7
1 r1234 8
2 r1234 9
2 r1234 10
su r1234 11
su r1234 12
su r1234 13
su r1234 14
3 r1234 15
3 r1234 16
3 r1234 17
su r1235 18
su r1235 19
su r1235 20
su r1235 21
Su r1235 22
Su r1235 23
su r1235 24
1 r1235 25
2 r1235 26
2 r1235 27
;
run;
data want;
do i=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
 if first.batch then count=0;
end;

 if spool='SU' then do;isSU=1;count+1;end;
 
do j=1 by 1 until(last.spool);
 set have;
 by batch spool notsorted;
 if spool='SU' and count ne 1 then spool='IBSU';

 if i gt 4 and isSU then do;
  if j=i-3 or j=i-2 or j=i-1 or j=i then output;
 end;
 else output;
end;
 drop i j isSU;
run;




&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Aug 2016 02:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/292623#M19992</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-08-19T02:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/325190#M21704</link>
      <description>&lt;P&gt;Hei,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have a big dataset but i would selct some rows based in a condition.&lt;/P&gt;&lt;P&gt;i have som exeple:&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp; org_nr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;kode&amp;nbsp; v1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; v4&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to select&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with v1, v2, v3 and v4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the prosedure?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 07:53:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/325190#M21704</guid>
      <dc:creator>edelv</dc:creator>
      <dc:date>2017-01-17T07:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: select particular rows based on condition</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/325198#M21705</link>
      <description>&lt;P&gt;Please do not re-open an old question. &amp;nbsp;If you have a new question, open a new post. &amp;nbsp;Include in your post test data - in the form of a datastep - and what the output should look like. &amp;nbsp;Also, be clear as to the logic behind gettnig the output. &amp;nbsp;In your description below you mention nothing of which row to take, 3, 3 appears once, however 3,2 appears multiple times, so which one should it be?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 09:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/select-particular-rows-based-on-condition/m-p/325198#M21705</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-17T09:13:00Z</dc:date>
    </item>
  </channel>
</rss>

