<?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 missing across all rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533098#M146123</link>
    <description>&lt;P&gt;Thanks both of you. Excellent solutions.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Feb 2019 22:20:30 GMT</pubDate>
    <dc:creator>Cruise</dc:creator>
    <dc:date>2019-02-05T22:20:30Z</dc:date>
    <item>
      <title>Flag missing across all rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533089#M146118</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a data with missing and I'd like to flag those individuals with missing data across all the rows as shown in the snippet below.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions appreciated. Thanks in advance.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA HAVE;
INPUT ID DIAGNOSIS FLAG;
CARDS;  
1 3  0 
1 1  0
1 99 0
1 99 0
1 99 0
1 99 0
1 1  0
1 99 0
1 3  0
1 99 0
2 99 1
2 99 1
2 99 1
2 99 1
2 99 1
;
PROC PRINT; RUN; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Feb 2019 21:59:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533089#M146118</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-02-05T21:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: Flag missing across all rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533090#M146119</link>
      <description>&lt;P&gt;So 99 is indicating 'missing' here?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 22:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533090#M146119</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-02-05T22:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Flag missing across all rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533091#M146120</link>
      <description>YES</description>
      <pubDate>Tue, 05 Feb 2019 22:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533091#M146120</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-02-05T22:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Flag missing across all rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533094#M146121</link>
      <description>&lt;P&gt;You can do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id diagnosis;
cards;  
1 3 
1 1 
1 99
1 99
1 99
1 99
1 1 
1 99
1 3 
1 99
2 99
2 99
2 99
2 99
2 99
;

data want(drop=c);
   c=0;
   do _n_ = 1 by 1 until (last.id);
      set have;
      by id;
      if diagnosis=99 then c=c+1;
   end;

   do until (last.id);
      set have;
      by id;
      flag=ifn(c=_N_, 1, 0);
      output;
   end;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Feb 2019 22:10:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533094#M146121</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-02-05T22:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: Flag missing across all rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533095#M146122</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
DATA HAVE;
INPUT ID DIAGNOSIS;* FLAG;
CARDS;  
1 3  0 
1 1  0
1 99 0
1 99 0
1 99 0
1 99 0
1 1  0
1 99 0
1 3  0
1 99 0
2 99 1
2 99 1
2 99 1
2 99 1
2 99 1
;

proc sql;
create table want as
select *,sum(DIAGNOSIS=99)=n(id) as flag
from have 
group by id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Feb 2019 22:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533095#M146122</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-05T22:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Flag missing across all rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533098#M146123</link>
      <description>&lt;P&gt;Thanks both of you. Excellent solutions.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2019 22:20:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flag-missing-across-all-rows/m-p/533098#M146123</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-02-05T22:20:30Z</dc:date>
    </item>
  </channel>
</rss>

