<?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 grouping ids with result value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626959#M184978</link>
    <description>&lt;P&gt;Hi, need your help please.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
input id test $ result $;
1 GCCX NEG
1 GCCXO NEG
1 GCCX POS
2 GCCX NEG
3 GCCXO POS
3 GCCXO NEG
3 GCCX NEG
4 GCCX NEG
5 GCCX POS
5 GCCX POS
RUN;

I would like to have the our put like this:
 id test $ result $;
1 GCCX POS
2 GCCX NEG
3 GCCX POS
4 GCGX NEG
5 GCCX POS

if an id has at least one positive then i wold like to have it count once as pos.
if an id has no pos only neg then count that id only once as neg.  it does ot matter if it is GCCX OR GCCXO.



&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 24 Feb 2020 18:42:31 GMT</pubDate>
    <dc:creator>Dhana18</dc:creator>
    <dc:date>2020-02-24T18:42:31Z</dc:date>
    <item>
      <title>grouping ids with result value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626959#M184978</link>
      <description>&lt;P&gt;Hi, need your help please.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
input id test $ result $;
1 GCCX NEG
1 GCCXO NEG
1 GCCX POS
2 GCCX NEG
3 GCCXO POS
3 GCCXO NEG
3 GCCX NEG
4 GCCX NEG
5 GCCX POS
5 GCCX POS
RUN;

I would like to have the our put like this:
 id test $ result $;
1 GCCX POS
2 GCCX NEG
3 GCCX POS
4 GCGX NEG
5 GCCX POS

if an id has at least one positive then i wold like to have it count once as pos.
if an id has no pos only neg then count that id only once as neg.  it does ot matter if it is GCCX OR GCCXO.



&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Feb 2020 18:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626959#M184978</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2020-02-24T18:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: grouping ids with result value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626964#M184981</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id test $ result $;
datalines;
1 GCCX NEG
1 GCCXO NEG
1 GCCX POS
2 GCCX NEG
3 GCCXO POS
3 GCCXO NEG
3 GCCX NEG
4 GCCX NEG
5 GCCX POS
5 GCCX POS
;

data want;
   r='NEG';
   do until (last.id);
      set have;
      by id;
      if result='POS' then r='POS';
   end;
   result = r;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Feb 2020 18:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626964#M184981</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-24T18:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: grouping ids with result value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626969#M184984</link>
      <description>&lt;P&gt;proc sort data=SURRGWED.Epidata_COMBINED_RESULT;&lt;BR /&gt;by ClientID;&lt;BR /&gt;RUN;&lt;BR /&gt;data want;&lt;BR /&gt;r='NEG';&lt;BR /&gt;do until (last.ID);&lt;BR /&gt;set have;&lt;BR /&gt;by ID;&lt;BR /&gt;if result='POS' then r='POS';&lt;BR /&gt;end;&lt;BR /&gt;result = r;&lt;BR /&gt;run;&lt;BR /&gt;proc freq data=want;&lt;BR /&gt;table RESULT*r/NOROW NOCOL NOPERCENT;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it did not give me positive results. here is the put put.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; result Neg&lt;/P&gt;&lt;P&gt;r&amp;nbsp; &amp;nbsp; neg&amp;nbsp; &amp;nbsp; &amp;nbsp; 4839&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 19:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626969#M184984</guid>
      <dc:creator>Dhana18</dc:creator>
      <dc:date>2020-02-24T19:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: grouping ids with result value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626982#M184991</link>
      <description>&lt;P&gt;Seems like your actual ID variable is &lt;EM&gt;&lt;STRONG&gt;ClientID&lt;/STRONG&gt;&lt;/EM&gt; and not just &lt;EM&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 19:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626982#M184991</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-24T19:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: grouping ids with result value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626983#M184992</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc format;
   invalue resi
   'POS'=1
   'NEG'=0;
   value resv
   1='POS'
   0='NEG';
run;

data have;
input id test:$4. result $;
resn=input(result,resi.);
datalines;
1 GCCX NEG
1 GCCXO NEG
1 GCCX POS
2 GCCX NEG
3 GCCXO POS
3 GCCXO NEG
3 GCCX NEG
4 GCCX NEG
5 GCCX POS
5 GCCX POS
;
proc summary nway data=have(drop=result);
   class id;
   id test;
   var resn;
   output out=want (drop=_:)
   max=result;
 run;
proc print;
   format result resv.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36359i39C1073246D04BF6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled.png" alt="Untitled.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2020 19:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/626983#M184992</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2020-02-24T19:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: grouping ids with result value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/627098#M185028</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id test $ result $;
datalines;
1 GCCX NEG
1 GCCXO NEG
1 GCCX POS
2 GCCX NEG
3 GCCXO POS
3 GCCXO NEG
3 GCCX NEG
4 GCCX NEG
5 GCCX POS
5 GCCX POS
;

proc sql;
select id,min(test) as test,ifc(sum(result='POS'),'POS','NEG') as want
 from have
  group by id;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Feb 2020 05:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/grouping-ids-with-result-value/m-p/627098#M185028</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-02-25T05:02:11Z</dc:date>
    </item>
  </channel>
</rss>

