<?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 eliminating group based on one outcome in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233645#M16918</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I am faced with an issue currently, and wondering if any sas gurus can provide me some feedback.&lt;/P&gt;
&lt;P&gt;I am currently trying to populate a single record for each individual&amp;nbsp;(i.e. tom and jerry) for each year based on the outcome i.e. PASS/ FAIL.&lt;/P&gt;
&lt;P&gt;The "fail" table will display a single record&amp;nbsp;for each individual each year if the individual has failed at least once that year.&lt;/P&gt;
&lt;P&gt;The "pass" table will display a single record for each individual each year if the individual has not failed even once in that particular year.&lt;/P&gt;
&lt;P&gt;I present my input dataset below:&lt;/P&gt;
&lt;PRE&gt;data input;
input name $6. outcome $5. year 4.;
datalines;
tom   pass 2011
tom   pass 2011
tom   pass 2011
tom   pass 2012
tom   fail 2012
tom   pass 2012
tom   pass 2013
tom   pass 2013
tom   pass 2013
tom   pass 2013
jerry pass 2011
jerry fail 2011
jerry fail 2011
jerry fail 2011
jerry pass 2012
jerry pass 2012
jerry pass 2012
jerry fail 2013
jerry fail 2013
jerry fail 2013
;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The outcome tables are noted below:&lt;/P&gt;
&lt;TABLE width="228" style="width: 228px; height: 140px;"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="128" colspan="2"&gt;&lt;STRONG&gt;OUTPUT&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="64"&gt;&lt;STRONG&gt;FAIL Table&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tom&lt;/TD&gt;
&lt;TD&gt;fail&lt;/TD&gt;
&lt;TD&gt;2012&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;jerry&lt;/TD&gt;
&lt;TD&gt;fail&lt;/TD&gt;
&lt;TD&gt;2011&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;jerry&lt;/TD&gt;
&lt;TD&gt;fail&lt;/TD&gt;
&lt;TD&gt;2013&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="192"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;&lt;STRONG&gt;output:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="128" colspan="2"&gt;&lt;STRONG&gt;pass table&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tom&lt;/TD&gt;
&lt;TD&gt;pass&lt;/TD&gt;
&lt;TD&gt;2011&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tom&lt;/TD&gt;
&lt;TD&gt;pass&lt;/TD&gt;
&lt;TD&gt;2013&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;jerry&lt;/TD&gt;
&lt;TD&gt;pass&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;2012&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried using a datastep procedure i.e. first and last but could not find a way of proceeding further.&lt;/P&gt;
&lt;P&gt;All help would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;Many thanks.&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;S.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 07 Nov 2015 18:00:54 GMT</pubDate>
    <dc:creator>sebster24</dc:creator>
    <dc:date>2015-11-07T18:00:54Z</dc:date>
    <item>
      <title>eliminating group based on one outcome</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233645#M16918</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
&lt;P&gt;I am faced with an issue currently, and wondering if any sas gurus can provide me some feedback.&lt;/P&gt;
&lt;P&gt;I am currently trying to populate a single record for each individual&amp;nbsp;(i.e. tom and jerry) for each year based on the outcome i.e. PASS/ FAIL.&lt;/P&gt;
&lt;P&gt;The "fail" table will display a single record&amp;nbsp;for each individual each year if the individual has failed at least once that year.&lt;/P&gt;
&lt;P&gt;The "pass" table will display a single record for each individual each year if the individual has not failed even once in that particular year.&lt;/P&gt;
&lt;P&gt;I present my input dataset below:&lt;/P&gt;
&lt;PRE&gt;data input;
input name $6. outcome $5. year 4.;
datalines;
tom   pass 2011
tom   pass 2011
tom   pass 2011
tom   pass 2012
tom   fail 2012
tom   pass 2012
tom   pass 2013
tom   pass 2013
tom   pass 2013
tom   pass 2013
jerry pass 2011
jerry fail 2011
jerry fail 2011
jerry fail 2011
jerry pass 2012
jerry pass 2012
jerry pass 2012
jerry fail 2013
jerry fail 2013
jerry fail 2013
;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The outcome tables are noted below:&lt;/P&gt;
&lt;TABLE width="228" style="width: 228px; height: 140px;"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="128" colspan="2"&gt;&lt;STRONG&gt;OUTPUT&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="64"&gt;&lt;STRONG&gt;FAIL Table&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tom&lt;/TD&gt;
&lt;TD&gt;fail&lt;/TD&gt;
&lt;TD&gt;2012&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;jerry&lt;/TD&gt;
&lt;TD&gt;fail&lt;/TD&gt;
&lt;TD&gt;2011&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;jerry&lt;/TD&gt;
&lt;TD&gt;fail&lt;/TD&gt;
&lt;TD&gt;2013&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="192"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;&lt;STRONG&gt;output:&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="128" colspan="2"&gt;&lt;STRONG&gt;pass table&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tom&lt;/TD&gt;
&lt;TD&gt;pass&lt;/TD&gt;
&lt;TD&gt;2011&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;tom&lt;/TD&gt;
&lt;TD&gt;pass&lt;/TD&gt;
&lt;TD&gt;2013&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;jerry&lt;/TD&gt;
&lt;TD&gt;pass&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;2012&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried using a datastep procedure i.e. first and last but could not find a way of proceeding further.&lt;/P&gt;
&lt;P&gt;All help would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;Many thanks.&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;S.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2015 18:00:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233645#M16918</guid>
      <dc:creator>sebster24</dc:creator>
      <dc:date>2015-11-07T18:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: eliminating group based on one outcome</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233647#M16919</link>
      <description>&lt;P&gt;/* Fail Table */&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table fail as&lt;BR /&gt;select distinct name, outcome, year from input group by name,year&lt;BR /&gt;having sum(outcome='fail')&amp;gt;=1 and outcome='fail';&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/* Pass Table */&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table pass as&lt;BR /&gt;select distinct name, outcome, year from input group by name,year&lt;BR /&gt;having sum(outcome='fail')=0;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2015 18:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233647#M16919</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2015-11-07T18:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: eliminating group based on one outcome</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233649#M16920</link>
      <description>&lt;P&gt;Here is a data step solution:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data pass fail;
do until (last.year);
set input;
by name year notsorted;
if outcome='fail' then _n_=0;
end;
if _n_=0 then do; outcome='fail';output fail;end;
else output pass;
run;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Nov 2015 22:11:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233649#M16920</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-11-07T22:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: eliminating group based on one outcome</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233660#M16922</link>
      <description>&lt;P&gt;There are many ways to approach this, and you already have some valid suggestions. &amp;nbsp;I'm just adding this one because it might be easier to understand given the approach you already started using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;by name year outcome;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data pass fail;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;by name year;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if first.year;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;if outcome='pass' then output pass;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;else output fail;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Nov 2015 02:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233660#M16922</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-08T02:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: eliminating group based on one outcome</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233669#M16923</link>
      <description>I see some great solution above .In case you are new you can try this .&lt;BR /&gt;&lt;BR /&gt;data newdata faildata passdata ;&lt;BR /&gt;set mydata;&lt;BR /&gt;if outcome  = 'fail' then output faildata;&lt;BR /&gt;Else;&lt;BR /&gt;if outcome  = 'pass' then output  passdata;&lt;BR /&gt;run;</description>
      <pubDate>Sun, 08 Nov 2015 08:55:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/eliminating-group-based-on-one-outcome/m-p/233669#M16923</guid>
      <dc:creator>pearsoninst</dc:creator>
      <dc:date>2015-11-08T08:55:54Z</dc:date>
    </item>
  </channel>
</rss>

