<?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: Deleting all observations with same ID if missing data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/581054#M165111</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID    Gender     Income ;
cards;
1         1             5000
1         1             7000 
1         1                .
2         2             3000
2         2             5000
2         2             1000
3         1              .
3         1             900000
3         1             12345
;
proc sql;
create table want as
select *
 from have
  group by id
   having nmiss(income)=0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 14 Aug 2019 11:31:56 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2019-08-14T11:31:56Z</dc:date>
    <item>
      <title>Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580972#M165074</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently working with a panel data. I have found that some of the IDs are missing some values for some of the years. I would like to delete the IDs if they have any missing variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; &amp;nbsp; Gender&amp;nbsp; &amp;nbsp; &amp;nbsp;Income&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5000&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7000&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3000&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;5000&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1000&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;900000&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12345&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since ID number 1 and 3 have missing data, I would like to delete all observations under #1 and 3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've merged and transposed data from multiple datasets to create a single dataset.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 01:52:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580972#M165074</guid>
      <dc:creator>hwkim286</dc:creator>
      <dc:date>2019-08-14T01:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580973#M165075</link>
      <description>&lt;P&gt;Not tested but code as below should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* option 1 */
data want;
  if _n_=1 then
    do;
      dcl hash h1(dataset:'have(where=(missing(income)))', duplicate:'r');
      h1.defineKey('id');
      h1.defineDone();
    end;
  set have;
  if h1.check() ne 0 then delete;
run;

/* option 2 */
proc sql;
  delete from have o
  where exists
  (select * from have i where i.income is missing and i.id=o.id)
  ;
quit;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 02:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580973#M165075</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-08-14T02:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580974#M165076</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID    Gender     Income ;
cards;
1         1             5000
1         1             7000 
1         1                .
2         2             3000
2         2             5000
2         2             1000
3         1              .
3         1             900000
3         1             12345
;
data want;
merge have(in=a where=(missing(income))) have(in=b) ;
by id;
if b and not a;
run;&lt;/CODE&gt;&lt;/PRE&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;proc sql;
create table want as
select *
from have
where id not in (select id from have where missing(income));
quit;
 &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 02:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580974#M165076</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-08-14T02:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580975#M165077</link>
      <description>&lt;P&gt;Just one more 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 have
group by ID
having count(INCOME) = count(*);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 03:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580975#M165077</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-08-14T03:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580976#M165078</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
do until(last.id);
	set have;
	by id;
	if missing(income) then miss=sum(miss,1);
end;

do until(last.id);
	set have;
	by id;
	if miss&amp;lt; 0 then output;
end;

drop miss;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 03:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580976#M165078</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2019-08-14T03:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580978#M165079</link>
      <description>&lt;P&gt;Just to be different, but hash (if not sorted) and merge (if sorted) are most likely the best options.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  REC_START_NO = sum(1,REC_END_NO);
  REC_KEEP     = 1;

  do until(last.ID);
    set HAVE;
    by ID;
    REC_KEEP   + -missing(INCOME);
    REC_END_NO + 1;
  end;

  do REC_NO = REC_START_NO to REC_END_NO while(REC_KEEP);
    set HAVE point = REC_NO;
    output;
  end;

  drop REC_: ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[Edited: Change flag from drop to keep]&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 23:13:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580978#M165079</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-08-14T23:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580989#M165088</link>
      <description>&lt;P&gt;Thank you guys for the help.&lt;/P&gt;&lt;P&gt;Is there a way to do the same for multiple variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PID&amp;nbsp; &amp;nbsp; &amp;nbsp;Gender&amp;nbsp; &amp;nbsp; &amp;nbsp;Income&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Net_worth&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;4999&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 111&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 131&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1441&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 555&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 24443&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 59530&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 155&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp;&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 122&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12312&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1244&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since PIDs 1 and 3 having missing values (1 in income and 3 in networth) I would like to delete all observations for both PIDs. PID is patient ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 06:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580989#M165088</guid>
      <dc:creator>hwkim286</dc:creator>
      <dc:date>2019-08-14T06:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580991#M165089</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;data have;
input PID Gender Income Net_worth;
datalines;
1 1 4999 .
1 1 . 111
1 1 131 1441
2 2 1000 555
2 2 2000 24443
2 2 3000 59530
3 1 155 . 
3 1 122 12312
3 1 1244 .
;

data want;
   if _N_=1 then do;
      declare hash h(dataset:'have(where=(nmiss(Income, Net_worth) ge 1)');
      h.defineKey('PID');
      h.defineDone();
   end;
 
   set have;
   if h.check() ne 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 06:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580991#M165089</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-08-14T06:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580992#M165090</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;hash (if not sorted) and merge (if sorted) are most likely the best options"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Agreed! But still a like for thinking out of these and other boxes.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The efficiency of POINT= depends on data. Your approach &lt;EM&gt;includes&lt;/EM&gt; the same-key groups not having a missing value. If the input file were huge and the key-groups having a missing value were small and rare, it would be more efficient to find their obs numbers and mark them as deleted via MODIFY with POINT=. Then the rest of the processing would just read the original file, auto-&lt;EM&gt;excluding&lt;/EM&gt; the marked records. The SQL's DELETE basically does the same, but I don't know without testing how it stacks up against MODIFY performance-wise.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Kind regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Paul D.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 06:46:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/580992#M165090</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-08-14T06:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/581054#M165111</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID    Gender     Income ;
cards;
1         1             5000
1         1             7000 
1         1                .
2         2             3000
2         2             5000
2         2             1000
3         1              .
3         1             900000
3         1             12345
;
proc sql;
create table want as
select *
 from have
  group by id
   having nmiss(income)=0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Aug 2019 11:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/581054#M165111</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-08-14T11:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/581309#M165208</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/21262"&gt;@hashman&lt;/a&gt;&amp;nbsp;&amp;nbsp;Good points .&lt;/P&gt;
&lt;P&gt;In any case, since we are reading one BY group at a time, I expect the data set pages to be still be loaded in memory when the POINT= read operations take place (if they do), so the speed should be tolerable.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 23:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/581309#M165208</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-08-14T23:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting all observations with same ID if missing data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/581331#M165216</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;:&lt;/P&gt;
&lt;P&gt;With your approach, I'd expect POINT= perform very well at any rate since your step never uses it to read the file out of order. It would be particularly true with enough memory to SASFILE it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I meant by "exclude rather than include" is something in this vein:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;                                 
  input id gender income ;                  
cards;                                      
1  1  5000                                  
1  1     .                                  
1  1  7000                                  
1  1     .                                  
2  2  3000                                  
2  2  5000                                  
2  2  1000                                  
3  1   .                                    
3  1  900000                                
3  1  12345                                 
;                                           
run ;                                       
                                            
data rid (keep = rid_:) ;                   
  do until (last.id) ;                      
    set have (keep = id income) curobs = q ;
    by id ;                                 
    if first.id then rid_from = q ;         
    if missing (income) then _missflag = 1 ;
  end ;                                     
  if _missflag ;                            
  rid_to = q ;                              
run ;                                       
                                            
data have ;                                 
  set rid ;                                 
  do rid = rid_from to rid_to ;             
    modify have point = rid ;               
    remove ;                                
  end ;                                     
run ;                                       
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'd expect it to perform faster than pretty much anything else against HAVE with a small number of short "missing" ID groups relative to the overall number of ID groups.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 01:48:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-all-observations-with-same-ID-if-missing-data/m-p/581331#M165216</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2019-08-15T01:48:58Z</dc:date>
    </item>
  </channel>
</rss>

