<?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: By Group how to Identify if one of the Visit is Present however another Visit is missing. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957537#M373786</link>
    <description>thank you Ksharp &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Wed, 29 Jan 2025 07:00:07 GMT</pubDate>
    <dc:creator>PC7</dc:creator>
    <dc:date>2025-01-29T07:00:07Z</dc:date>
    <item>
      <title>By Group how to Identify if one of the Visit is Present however another Visit is missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957530#M373782</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input ID $1-3 Visit $5-7;
cards; 
101 v1
101 v2
101 v3
101 v4
101 v5
102 v1
102 v2
102 v3
102 v5
103 v1
103 v2
103 v3
103 v4
;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Looking for participant ID if v5 is present, however, v4 is missing then we need to flag.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected Output should be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;id&lt;/TD&gt;&lt;TD&gt;visit&lt;/TD&gt;&lt;TD&gt;flag&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;v1&lt;/TD&gt;&lt;TD&gt;Missing visit 4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;v2&lt;/TD&gt;&lt;TD&gt;Missing visit 4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;v3&lt;/TD&gt;&lt;TD&gt;Missing visit 4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;v5&lt;/TD&gt;&lt;TD&gt;Missing visit 4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 29 Jan 2025 04:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957530#M373782</guid>
      <dc:creator>PC7</dc:creator>
      <dc:date>2025-01-29T04:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: By Group how to Identify if one of the Visit is Present however another Visit is missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957533#M373783</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID $1-3 Visit $5-7;
cards; 
101 v1
101 v2
101 v3
101 v4
101 v5
102 v1
102 v2
102 v3
102 v5
103 v1
103 v2
103 v3
103 v4
;
RUN;
proc sql;
create table want as
select *,ifc(sum(visit='v5') ne 0 and sum(visit='v4') eq 0,'Missing visit 4',' ') as flag
 from have
  group by id;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2025 05:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957533#M373783</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-29T05:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: By Group how to Identify if one of the Visit is Present however another Visit is missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957534#M373784</link>
      <description>&lt;P&gt;Below selects all IDs with a visit=5 and populates the "flag" if there is no visit=v4&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	if _n_=1 then
		do;
/* 			dcl hash h1(dataset:'have'); */
			dcl hash h1(dataset:'have(where=(visit in ("v4","v5")))');
			h1.defineKey('id','visit');
			h1.defineDone();
		end;
	set have;
	if h1.check(key:id, key:'v5') = 0 then 
		do;
			if h1.check(key:id, key:'v4') ne 0 then flag='Missing visit 4';
			output;
		end;
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Jan 2025 06:35:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957534#M373784</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-01-29T06:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: By Group how to Identify if one of the Visit is Present however another Visit is missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957536#M373785</link>
      <description>&lt;P&gt;Thank you so much for the quick solution. Both the codes am getting as expected result.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jan 2025 06:59:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957536#M373785</guid>
      <dc:creator>PC7</dc:creator>
      <dc:date>2025-01-29T06:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: By Group how to Identify if one of the Visit is Present however another Visit is missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957537#M373786</link>
      <description>thank you Ksharp &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 29 Jan 2025 07:00:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/By-Group-how-to-Identify-if-one-of-the-Visit-is-Present-however/m-p/957537#M373786</guid>
      <dc:creator>PC7</dc:creator>
      <dc:date>2025-01-29T07:00:07Z</dc:date>
    </item>
  </channel>
</rss>

