<?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: Flag a record where sequence is broken in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272538#M7593</link>
    <description>&lt;P&gt;So does that mean that your "want" example data set is exactly the opposite of what you want?&lt;/P&gt;</description>
    <pubDate>Mon, 23 May 2016 19:52:25 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-05-23T19:52:25Z</dc:date>
    <item>
      <title>Flag a record where sequence is broken</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272515#M7588</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to flag a record where sequence is broken (0=no, 1=yes)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;input account sequence&lt;BR /&gt;datalines;&lt;BR /&gt;1 1&lt;BR /&gt;1 2&lt;BR /&gt;1 3&lt;BR /&gt;2 2&lt;BR /&gt;2 3&lt;BR /&gt;3 1&lt;BR /&gt;3 2&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Want&lt;BR /&gt;Account Flag&lt;BR /&gt;1 1&lt;BR /&gt;2 0&lt;BR /&gt;3 1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 18:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272515#M7588</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2016-05-23T18:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Flag a record where sequence is broken</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272519#M7589</link>
      <description>&lt;P&gt;Simple&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input account sequence;
datalines;
1 1
1 2
1 3
2 2
2 3
3 1
3 2
;

data want;
flag = 1;
do seq = 1 by 1 until (last.account);
    set have; by account;
    if seq ne sequence then flag = 0;
    end;
keep account flag;
run;

proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 May 2016 19:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272519#M7589</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-05-23T19:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Flag a record where sequence is broken</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272521#M7590</link>
      <description>&lt;P&gt;You'll have to explain the problem a little better.&amp;nbsp; None of these sequences look broken to me.&amp;nbsp; So why do you want 1, 0, 1 as the results?&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 19:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272521#M7590</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-23T19:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Flag a record where sequence is broken</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272529#M7591</link>
      <description>&lt;P&gt;Thank you , I want the sequence starting froom 1,2,3 if it does not have a 1 that means the sequence is broken (2,3) is not in order of 1,2 3.&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 19:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272529#M7591</guid>
      <dc:creator>AZIQ1</dc:creator>
      <dc:date>2016-05-23T19:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Flag a record where sequence is broken</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272538#M7593</link>
      <description>&lt;P&gt;So does that mean that your "want" example data set is exactly the opposite of what you want?&lt;/P&gt;</description>
      <pubDate>Mon, 23 May 2016 19:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272538#M7593</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-05-23T19:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: Flag a record where sequence is broken</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272562#M7596</link>
      <description>&lt;P&gt;If your 'sequence' always starts from '1', here is a SQL option:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input account sequence;
	datalines;
1 1
1 2
1 3
2 2
2 3
3 1
3 2
;

proc sql;
	create table want as
		select account, (count(distinct sequence)=max(sequence)) as flag
			from have
				group by account
	;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 May 2016 20:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Flag-a-record-where-sequence-is-broken/m-p/272562#M7596</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-05-23T20:44:12Z</dc:date>
    </item>
  </channel>
</rss>

