<?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: query for parent in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738397#M230337</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327170"&gt;@Aexor&lt;/a&gt;&amp;nbsp;can be solve by using Hash Object&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
if _n_ eq 1 then do;
declare hash h(dataset:'have');
h.defineKEY('Child');
h.definedata('parent');
h.definedone();
end;
do until ( eof2 ) ;
 set have end = eof2 ;
 if h.find(key:parent) ne 0 then 
 OUTPUT;
 end ;
 stop ; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;SS&lt;/P&gt;</description>
    <pubDate>Sun, 02 May 2021 12:50:16 GMT</pubDate>
    <dc:creator>singhsahab</dc:creator>
    <dc:date>2021-05-02T12:50:16Z</dc:date>
    <item>
      <title>query for parent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738383#M230324</link>
      <description>&lt;P&gt;I have a table like this:&lt;/P&gt;
&lt;P&gt;Parent&amp;nbsp; Child&lt;/P&gt;
&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B&lt;/P&gt;
&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C&lt;/P&gt;
&lt;P&gt;C&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; D&lt;/P&gt;
&lt;P&gt;I&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;J&lt;/P&gt;
&lt;P&gt;J&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;K&lt;/P&gt;
&lt;P&gt;K&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; L&lt;/P&gt;
&lt;P&gt;i want to write a query which which output values which are parent only having no child.&lt;/P&gt;
&lt;P&gt;Output&amp;nbsp; A and I&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 11:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738383#M230324</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2021-05-02T11:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: query for parent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738388#M230329</link>
      <description>&lt;P&gt;I think this is what you want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 input Parent $ Child $;
 cards;
A            B
B            C
C            D
I            J
J            K
K            L
;
run;

PROC SQL noprint;
 create table want as
 select Parent
 from have
 where Parent NOT IN (select Child from have)
;
QUIT;

dm 'FSV';
/* end of program */&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 11:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738388#M230329</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-05-02T11:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: query for parent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738397#M230337</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/327170"&gt;@Aexor&lt;/a&gt;&amp;nbsp;can be solve by using Hash Object&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want;
if _n_ eq 1 then do;
declare hash h(dataset:'have');
h.defineKEY('Child');
h.definedata('parent');
h.definedone();
end;
do until ( eof2 ) ;
 set have end = eof2 ;
 if h.find(key:parent) ne 0 then 
 OUTPUT;
 end ;
 stop ; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;SS&lt;/P&gt;</description>
      <pubDate>Sun, 02 May 2021 12:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738397#M230337</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2021-05-02T12:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: query for parent</title>
      <link>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738997#M230599</link>
      <description>&lt;P&gt;I suspect you want to know more than just A and I here?&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 17:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/query-for-parent/m-p/738997#M230599</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-05-04T17:57:01Z</dc:date>
    </item>
  </channel>
</rss>

