<?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 Picking subjects with missing visit in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20273#M3153</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;﻿&lt;IMG alt="SAS.JPG" class="jive-image" src="https://communities.sas.com/legacyfs/online/1180_SAS.JPG" /&gt;&lt;/P&gt;&lt;P&gt;I have a scenario where I need to pick subject who doesn't have a corresponding repeat visit for occurance of an UNSATISFACTORY in Var1. Here in the above example subject 100 has a unsatisfactory for&lt;STRONG&gt; Year 1&lt;/STRONG&gt; visit so he comes in for a repeat visit &lt;STRONG&gt;Year 1 Repeat&lt;/STRONG&gt;. But I need to find out subjects who doesn't make it to that repeat visit. I made up a Year 2 Repeat visit as greyed out here as expected record but right now missing in the database table. I can split this dataset into different datasets and somehow find out the missing repeat visit for a UNSATISFACTORY Visit but I would like to know if there is any other efficient way of find this out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bob &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Sep 2011 21:57:53 GMT</pubDate>
    <dc:creator>User123</dc:creator>
    <dc:date>2011-09-29T21:57:53Z</dc:date>
    <item>
      <title>Picking subjects with missing visit</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20273#M3153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;﻿&lt;IMG alt="SAS.JPG" class="jive-image" src="https://communities.sas.com/legacyfs/online/1180_SAS.JPG" /&gt;&lt;/P&gt;&lt;P&gt;I have a scenario where I need to pick subject who doesn't have a corresponding repeat visit for occurance of an UNSATISFACTORY in Var1. Here in the above example subject 100 has a unsatisfactory for&lt;STRONG&gt; Year 1&lt;/STRONG&gt; visit so he comes in for a repeat visit &lt;STRONG&gt;Year 1 Repeat&lt;/STRONG&gt;. But I need to find out subjects who doesn't make it to that repeat visit. I made up a Year 2 Repeat visit as greyed out here as expected record but right now missing in the database table. I can split this dataset into different datasets and somehow find out the missing repeat visit for a UNSATISFACTORY Visit but I would like to know if there is any other efficient way of find this out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bob &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 21:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20273#M3153</guid>
      <dc:creator>User123</dc:creator>
      <dc:date>2011-09-29T21:57:53Z</dc:date>
    </item>
    <item>
      <title>Picking subjects with missing visit</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20274#M3154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you'll get the best response if you state your requirements in terms of what your data state.&amp;nbsp; Are your fields for visit coded 10, 20, etc. or do they also include the (description).&amp;nbsp; Same question for var1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If they include the descriptions, are they in mixed case as shown in your example (e.g., year and Year)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regardless, what is your specific requirement.&amp;nbsp; My initial guess would be that your data include both numbers and description and that you want those who have a visit=20(year 1) and var1=25(unsatisfactory) as well as having a visit=40(year 2) and a var1=25(unsatisfactory).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 22:46:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20274#M3154</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-29T22:46:26Z</dc:date>
    </item>
    <item>
      <title>Picking subjects with missing visit</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20275#M3155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, Visit and Var1 are coded only numeric. NO DESCRIPTION. &lt;/P&gt;&lt;P&gt;Second, Per subjid- for every occurance of Visit=10 and var1=25 there should be a corresponding Visit=30 row and&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for every occurance of Visit=20 and var1=25 there should be a corresponding Visit=40 row present in the database table. If this above criteria is missing I want to know.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2011 14:03:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20275#M3155</guid>
      <dc:creator>User123</dc:creator>
      <dc:date>2011-10-03T14:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Picking subjects with missing visit</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20276#M3156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&amp;nbsp; I'm not sure that I understand all the possibilities, but given these criteria ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;Per subjid- &lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;for every occurrence of Visit=10 and var1=25 there should be a corresponding Visit=30 row &lt;/P&gt;&lt;P style="background-color: #ffffff;"&gt;for every occurrence of Visit=20 and var1=25 there should be a corresponding Visit=40 row &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one idea is to use EXCEPT in PROC SQL to find observations in the 1st data set &lt;/P&gt;&lt;P&gt;not present in the 2nd data set (here they are the same data set).&amp;nbsp; The ALL results in &lt;/P&gt;&lt;P&gt;subjid 300 being listed twice in the first query (two occurrences of visit=10, var1=25&lt;/P&gt;&lt;P&gt;and no corresponding visit=40) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data x;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;input subjid visit var1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;datalines;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;100 10 24&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;100 20 25&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;100 30 24&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;200 10 25&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;200 30 24&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;300 10 25&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;300 10 25&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;300 20 25&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;400 20 25&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;400 40 24&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;title "subjects with visit=10, var1=25 and no visit=30";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;select subjid from x (where=(visit eq 10 and var1 eq 25))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;except all&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;select subjid from x (where=(visit eq 30));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;title "subjects with visit=20, var1=25 and no visit=40";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;select subjid from x (where=(visit eq 20 and var1 eq 25))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;except all&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;select subjid from x (where=(visit eq 40));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;quit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also merge the data set with itself BY SUBJID (given a sorted data set) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data a;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;merge x (where=(visit eq 10 and var1 eq 25) in=a)&amp;nbsp; x (where=(visit eq 30) in=b);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;if a and ^b;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;by subjid;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data b;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;merge x (where=(visit eq 20 and var1 eq 25) in=a)&amp;nbsp; x (where=(visit eq 40) in=b);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;if a and ^b;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;by subjid;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or a hash object (visit_ is the original value of visit in an unmatched observation) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data ab;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;declare hash h(dataset:'x(where=(visit in (30 40))');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;h.defineKey('subjid','visit');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;h.defineDone();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do until(done);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; set x (where=(visit in (10 20) and var1 eq 25)) end=done;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; visit_&amp;nbsp; = visit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; visit&amp;nbsp;&amp;nbsp; = ifn(visit eq 10, 30, 40);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; if h.find() then output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;stop;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;drop visit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2011 17:39:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20276#M3156</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2011-10-03T17:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Picking subjects with missing visit</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20277#M3157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike-&lt;/P&gt;&lt;P&gt;Perfect. This is what I needed.&lt;/P&gt;&lt;P&gt;Thanks a bunch.&lt;/P&gt;&lt;P&gt;Bob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2011 12:52:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Picking-subjects-with-missing-visit/m-p/20277#M3157</guid>
      <dc:creator>User123</dc:creator>
      <dc:date>2011-10-05T12:52:03Z</dc:date>
    </item>
  </channel>
</rss>

