<?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: finding missing items in consecutive order in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30703#M7298</link>
    <description>Of course you can display the list in the Output.&lt;BR /&gt;
Just add the line :&lt;BR /&gt;
[pre]&lt;BR /&gt;
FILE PRINT ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
after the DATA _NULL_ ; statement.&lt;BR /&gt;
&lt;BR /&gt;
Olivier</description>
    <pubDate>Sat, 12 Jul 2008 10:47:32 GMT</pubDate>
    <dc:creator>Olivier</dc:creator>
    <dc:date>2008-07-12T10:47:32Z</dc:date>
    <item>
      <title>finding missing items in consecutive order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30700#M7295</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have a data set which should have all of the following in consecutive order:&lt;BR /&gt;
&lt;BR /&gt;
Q001&lt;BR /&gt;
Q002&lt;BR /&gt;
Q003&lt;BR /&gt;
Q004&lt;BR /&gt;
   '&lt;BR /&gt;
   '&lt;BR /&gt;
   '&lt;BR /&gt;
Q180&lt;BR /&gt;
&lt;BR /&gt;
How do I find which ones are missing, for example, if Q 175 is missing?&lt;BR /&gt;
I tried to do a proc sort, then a proc freq, by this variable, but it's labor intensive to look through each one and determine if one is missing.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Thu, 10 Jul 2008 18:11:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30700#M7295</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-07-10T18:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: finding missing items in consecutive order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30701#M7296</link>
      <description>Hi.&lt;BR /&gt;
I suggest you sort and deduplicate the values, then compare the number to the previous one in a datastep ; each time the difference is &amp;gt; 1, you print a message.&lt;BR /&gt;
[pre]&lt;BR /&gt;
PROC SORT DATA = myData OUT = myValues NODUPKEY ;&lt;BR /&gt;
  BY myVariable ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
DATA _NULL_ ;&lt;BR /&gt;
  SET myValues ;&lt;BR /&gt;
  previousVal = LAG(myVariable) ;&lt;BR /&gt;
  IF _N_&amp;gt;1 THEN DO ;&lt;BR /&gt;
    gap = SUBSTR(myVariable,2) - SUBSTR(previousVal, 2) ;&lt;BR /&gt;
    nbMissing = gap-1 ;&lt;BR /&gt;
    IF nbMissing &amp;gt; 0 THEN PUT nbMissing "missing value(s) between " previousVal " and " myVariable ;&lt;BR /&gt;
  END ;&lt;BR /&gt;
RUN ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Regards.&lt;BR /&gt;
Olivier</description>
      <pubDate>Fri, 11 Jul 2008 08:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30701#M7296</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2008-07-11T08:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: finding missing items in consecutive order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30702#M7297</link>
      <description>This works very well!  Thanks so much!&lt;BR /&gt;
Is it possible to print the list in the output (vs. the log)?  Thanks!

Message was edited by: jcis</description>
      <pubDate>Fri, 11 Jul 2008 20:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30702#M7297</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-07-11T20:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: finding missing items in consecutive order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30703#M7298</link>
      <description>Of course you can display the list in the Output.&lt;BR /&gt;
Just add the line :&lt;BR /&gt;
[pre]&lt;BR /&gt;
FILE PRINT ;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
after the DATA _NULL_ ; statement.&lt;BR /&gt;
&lt;BR /&gt;
Olivier</description>
      <pubDate>Sat, 12 Jul 2008 10:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30703#M7298</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2008-07-12T10:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: finding missing items in consecutive order</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30704#M7299</link>
      <description>Thanks so much!  Much appreciated!</description>
      <pubDate>Wed, 16 Jul 2008 15:28:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/finding-missing-items-in-consecutive-order/m-p/30704#M7299</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-07-16T15:28:06Z</dc:date>
    </item>
  </channel>
</rss>

