<?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 how to include records which has &amp;quot;Y&amp;quot; for all ID's. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585610#M167034</link>
    <description>&lt;P&gt;I want to filter on records which has "Y" across id's and exclude id's which has "Y" for some id and "N" or missing for the rest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data WORK.ADS;&lt;BR /&gt;infile datalines dsd truncover;&lt;BR /&gt;input ID:BEST12. ecs:BEST12. par:$8. flag1:$1.;&lt;BR /&gt;datalines4;&lt;BR /&gt;12,1,par1,Y&lt;BR /&gt;12,2,par1,Y&lt;BR /&gt;12,3,par1,Y&lt;BR /&gt;12,4,par2,Y&lt;BR /&gt;13,1,par1,&lt;BR /&gt;13,2,par1,Y&lt;BR /&gt;13,3,par1,N&lt;BR /&gt;13,4,par2,Y&lt;BR /&gt;14,1,par1,N&lt;BR /&gt;;;;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i would only want observations as it has "Y" for all&amp;nbsp; id, ecs, par&lt;/P&gt;&lt;P&gt;12,1,par1,Y&lt;BR /&gt;12,2,par1,Y&lt;BR /&gt;12,3,par1,Y&lt;/P&gt;&lt;P&gt;12,4,par2,Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any help on how to get them&lt;/P&gt;</description>
    <pubDate>Mon, 02 Sep 2019 13:30:49 GMT</pubDate>
    <dc:creator>noda6003</dc:creator>
    <dc:date>2019-09-02T13:30:49Z</dc:date>
    <item>
      <title>how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585610#M167034</link>
      <description>&lt;P&gt;I want to filter on records which has "Y" across id's and exclude id's which has "Y" for some id and "N" or missing for the rest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data WORK.ADS;&lt;BR /&gt;infile datalines dsd truncover;&lt;BR /&gt;input ID:BEST12. ecs:BEST12. par:$8. flag1:$1.;&lt;BR /&gt;datalines4;&lt;BR /&gt;12,1,par1,Y&lt;BR /&gt;12,2,par1,Y&lt;BR /&gt;12,3,par1,Y&lt;BR /&gt;12,4,par2,Y&lt;BR /&gt;13,1,par1,&lt;BR /&gt;13,2,par1,Y&lt;BR /&gt;13,3,par1,N&lt;BR /&gt;13,4,par2,Y&lt;BR /&gt;14,1,par1,N&lt;BR /&gt;;;;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i would only want observations as it has "Y" for all&amp;nbsp; id, ecs, par&lt;/P&gt;&lt;P&gt;12,1,par1,Y&lt;BR /&gt;12,2,par1,Y&lt;BR /&gt;12,3,par1,Y&lt;/P&gt;&lt;P&gt;12,4,par2,Y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any help on how to get them&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 13:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585610#M167034</guid>
      <dc:creator>noda6003</dc:creator>
      <dc:date>2019-09-02T13:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585611#M167035</link>
      <description>&lt;P&gt;One way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table want as
    select * from WORK.ADS
    group by ID
    having sum(flag1='Y')=count(ID);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2019 13:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585611#M167035</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-02T13:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585612#M167036</link>
      <description>&lt;P&gt;Here is a data step approach that assumes that the data is sorted by ID&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=c);
    c=0;
    do _N_=1 by 1 until (last.ID);
        set ads;
        by ID;
        if flag1='Y' then c=c+1;
    end;
    do until(last.ID);
        set ads;
        by ID;
        if _N_=c then output;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2019 13:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585612#M167036</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-02T13:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585613#M167037</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data WORK.ADS;
infile datalines dsd truncover;
input ID:BEST12. ecs:BEST12. par:$8. flag1:$1.;
datalines4;
12,1,par1,Y
12,2,par1,Y
12,3,par1,Y
12,4,par2,Y
13,1,par1,
13,2,par1,Y
13,3,par1,N
13,4,par2,Y
14,1,par1,N
;;;;

proc sql;
create table want as
select *
from ads
group by id
having count(distinct flag1)=1 and flag1='Y';
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2019 13:40:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585613#M167037</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-02T13:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585797#M167145</link>
      <description>&lt;P&gt;Just for fun.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data WORK.ADS;
infile datalines dsd truncover;
input ID:BEST12. ecs:BEST12. par:$8. flag1:$1.;
datalines4;
12,1,par1,Y
12,2,par1,Y
12,3,par1,Y
12,4,par2,Y
13,1,par1,
13,2,par1,Y
13,3,par1,N
13,4,par2,Y
14,1,par1,N
;;;;

proc sql;
create table want as
select *
 from ads where id not in (
select distinct id from ads where flag1 ne 'Y');
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 12:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/585797#M167145</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-09-03T12:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586131#M167290</link>
      <description>&lt;P&gt;Thanks, can i update it with condition adding if ecs=1 has "Y" and the rest of ecs for that ID has atleast one&amp;nbsp; "Y" then i need all id's with these cases instead of having all "Y". Can it be done on same step&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586131#M167290</guid>
      <dc:creator>noda6003</dc:creator>
      <dc:date>2019-09-04T14:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586376#M167397</link>
      <description>&lt;P&gt;Your question is quite ambiguous . Can you post the outpu you need.&lt;/P&gt;
&lt;P&gt;Here is base on what I know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data WORK.ADS;
infile datalines dsd truncover;
input ID:BEST12. ecs:BEST12. par:$8. flag1:$1.;
datalines4;
12,1,par1,Y
12,2,par1,Y
12,3,par1,Y
12,4,par2,Y
13,1,par1,
13,2,par1,Y
13,3,par1,N
13,4,par2,Y
14,1,par1,N
;;;;

proc sql;
select *,max(flag1) as new_flag
 from ads
  group by id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Sep 2019 11:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586376#M167397</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-09-05T11:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586385#M167400</link>
      <description>&lt;P&gt;&lt;EM&gt;"what I know."&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp; &amp;nbsp;&lt;/EM&gt;There isn't anything that you don't know. I found that funny.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 11:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586385#M167400</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-05T11:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586388#M167401</link>
      <description>&lt;P&gt;Sorry. Should be what I understand.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;English is not my native language ,so there is some glitch in my post as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt;&amp;nbsp; pointed out .&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 11:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586388#M167401</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-09-05T11:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to include records which has "Y" for all ID's.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586390#M167402</link>
      <description>&lt;P&gt;Hey come on!, What i meant is. Let me clarify. Is there anything does Xia Keshan doesn't know? The world will end. As I have said many times, my mother is your biggest fan. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS i didn't mean divert the attention of the focus of the topic. So my apologies to you and OP for that.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 12:00:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-include-records-which-has-quot-Y-quot-for-all-ID-s/m-p/586390#M167402</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-05T12:00:07Z</dc:date>
    </item>
  </channel>
</rss>

