<?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: Output all Records if &amp;quot;vacrec=No, at three or more consecutive visits&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809040#M319027</link>
    <description>&lt;P&gt;This seems to work. The variable CONSEC counts consecutive values of "No" and resets to zero whenever a "Yes" is found. Then SQL picks out the desired records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data intermediate;
    set have;
    by subject;
    if first.subject or vecrec='Yes' then do; 
        consec=0;
        group+1;
    end;
    if vecrec='No' then consec+1;
run;
proc sql;
    create table want as select subject,folder,folderseq,vecrec
    from intermediate
    where vecrec='No'
    group by group
    having max(consec)&amp;gt;=3;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 21 Apr 2022 12:47:23 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-04-21T12:47:23Z</dc:date>
    <item>
      <title>Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809030#M319021</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Could you please help me out,How to set up programming for below condition&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Output all Records if "vacrec=No, at three or more consecutive visits"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;subject&amp;nbsp; folder&amp;nbsp; folderseq&amp;nbsp; vecrec&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp;v1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.00&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; v2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.00&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; v3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.00&amp;nbsp; &amp;nbsp; &amp;nbsp; Yes&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; v4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4.00&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;v5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5.00&amp;nbsp; &amp;nbsp; &amp;nbsp;No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1001&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;v6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6.00&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1002&amp;nbsp; &amp;nbsp; &amp;nbsp; v1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.00&amp;nbsp; &amp;nbsp; &amp;nbsp;Yes&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1002&amp;nbsp; &amp;nbsp; &amp;nbsp; v2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.00&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1002&amp;nbsp; &amp;nbsp; &amp;nbsp; v3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3.00&amp;nbsp; &amp;nbsp; &amp;nbsp; Yes&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1002&amp;nbsp; &amp;nbsp; &amp;nbsp; v4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4.00&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1002&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;v5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5.00&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1002&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;v6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6.00&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1002&amp;nbsp; &amp;nbsp; &amp;nbsp; v7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7.00&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Note that "Do not output if one or two consecutive visits reported as No"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 12:24:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809030#M319021</guid>
      <dc:creator>PranayaG</dc:creator>
      <dc:date>2022-04-21T12:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809035#M319024</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423565"&gt;@PranayaG&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;&lt;SPAN&gt;Output all Records if "vacrec=No, at three or more consecutive visits"&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does this mean, for subject 1001 that you want all six records output, or does this mean that for subject 1001 you want folder v4 v5 and v6 output but not v1 v2 v3?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you provide a data set where at least one subject doesn't have 3 consecutive No?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 12:33:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809035#M319024</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-21T12:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809038#M319025</link>
      <description>Yes we want records, for subject 1001 v4 v5 v6 and for subject 1002 v4 v5 v6 v7 as a output&lt;BR /&gt;Please find below dataset&lt;BR /&gt;subject folder folderseq vecrec&lt;BR /&gt;1001 v1 1.00 No&lt;BR /&gt;1001 v2 2.00 No&lt;BR /&gt;1001 v3 3.00 Yes&lt;BR /&gt;1001 v4 4.00 No&lt;BR /&gt;1001 v5 5.00 No&lt;BR /&gt;1001 v6 6.00 No&lt;BR /&gt;1002 v1 1.00 Yes&lt;BR /&gt;1002 v2 2.00 No&lt;BR /&gt;1002 v3 3.00 Yes&lt;BR /&gt;1002 v4 4.00 No&lt;BR /&gt;1002 v5 5.00 No&lt;BR /&gt;1002 v6 6.00 No&lt;BR /&gt;1002 v7 7.00 No&lt;BR /&gt;1004 v2 2.00 Yes&lt;BR /&gt;1004 v3 3.00 No&lt;BR /&gt;1004 v4 4.00 No&lt;BR /&gt;1004 v5 5.00 Yes&lt;BR /&gt;1004 v6 6.00 No&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Apr 2022 12:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809038#M319025</guid>
      <dc:creator>PranayaG</dc:creator>
      <dc:date>2022-04-21T12:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809040#M319027</link>
      <description>&lt;P&gt;This seems to work. The variable CONSEC counts consecutive values of "No" and resets to zero whenever a "Yes" is found. Then SQL picks out the desired records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data intermediate;
    set have;
    by subject;
    if first.subject or vecrec='Yes' then do; 
        consec=0;
        group+1;
    end;
    if vecrec='No' then consec+1;
run;
proc sql;
    create table want as select subject,folder,folderseq,vecrec
    from intermediate
    where vecrec='No'
    group by group
    having max(consec)&amp;gt;=3;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Apr 2022 12:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809040#M319027</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-21T12:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809054#M319030</link>
      <description>&lt;P&gt;Same as Paige .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input (subject  folder  folderseq  vecrec) ($);
cards;
1001     v1        1.00       No
1001      v2        2.00      No
1001      v3        3.00      Yes
1001      v4        4.00      No
1001       v5        5.00     No
1001       v6       6.00      No
1002      v1        1.00     Yes
1002      v2        2.00      No
1002      v3        3.00      Yes
1002      v4        4.00      No
1002       v5       5.00      No
1002       v6       6.00      No
1002      v7        7.00      No
;

data temp;
 set have;
 by subject vecrec notsorted;
 group+first.vecrec;
run;
proc sql;
create table want as
select * from temp 
 where vecrec='No'
  group by group
   having count(*)&amp;gt;2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Apr 2022 13:24:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809054#M319030</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-04-21T13:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809066#M319035</link>
      <description>Suppose as I want vice versa like&amp;nbsp;if "vacrec=No, at one or two consecutive visits"&amp;nbsp; and Do not output if three or more consecutive visits reported as No.&lt;BR /&gt;Shall i need to do same?</description>
      <pubDate>Thu, 21 Apr 2022 13:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809066#M319035</guid>
      <dc:creator>PranayaG</dc:creator>
      <dc:date>2022-04-21T13:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809069#M319037</link>
      <description>having count(*)&amp;lt;3;</description>
      <pubDate>Thu, 21 Apr 2022 13:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809069#M319037</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-04-21T13:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809075#M319039</link>
      <description>Thanks Paige !!!!&lt;BR /&gt;It's works.</description>
      <pubDate>Thu, 21 Apr 2022 13:55:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809075#M319039</guid>
      <dc:creator>PranayaG</dc:creator>
      <dc:date>2022-04-21T13:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Output all Records if "vacrec=No, at three or more consecutive visits"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809076#M319040</link>
      <description>Thanks!!!&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Apr 2022 13:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-all-Records-if-quot-vacrec-No-at-three-or-more/m-p/809076#M319040</guid>
      <dc:creator>PranayaG</dc:creator>
      <dc:date>2022-04-21T13:56:09Z</dc:date>
    </item>
  </channel>
</rss>

