<?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: Nodes, Links, &amp; Routes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80092#M17258</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have SAS/OR licensed you may want to explore PROC BOM as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/orbomug/59689/HTML/default/viewer.htm#bom.htm" title="http://support.sas.com/documentation/cdl/en/orbomug/59689/HTML/default/viewer.htm#bom.htm"&gt;SAS/OR(R) 9.2 User's Guide: Bills of Material Processing&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Jun 2013 16:36:13 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2013-06-10T16:36:13Z</dc:date>
    <item>
      <title>Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80086#M17252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I've been having issues with the following programming task.&lt;/P&gt;&lt;P&gt;There are 2 columns, 1 with the "From" node, 1 with the "To" node.&lt;/P&gt;&lt;P&gt;Example,&lt;/P&gt;&lt;P&gt;A &amp;gt; B&lt;/P&gt;&lt;P&gt;B &amp;gt; C&lt;/P&gt;&lt;P&gt;B &amp;gt; D&lt;/P&gt;&lt;P&gt;C &amp;gt; E&lt;/P&gt;&lt;P&gt;C &amp;gt; B&lt;/P&gt;&lt;P&gt;I need to find all of the distinct child for each parent within the route.&lt;/P&gt;&lt;P&gt;In this case,&lt;/P&gt;&lt;P&gt;A &amp;gt; B C D E&lt;/P&gt;&lt;P&gt;B &amp;gt; C D E&lt;/P&gt;&lt;P&gt;C &amp;gt; B D E&lt;/P&gt;&lt;P&gt;I can transpose the original dataset to get the direct child for each parent, but can't figure out a way to get the child of the child.&lt;/P&gt;&lt;P&gt;Of course, this is just a simple example.&amp;nbsp; In real thing, it could have a lot more nodes and more complicated links.&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp; I have been trying to figure this out for a few days now.&amp;nbsp; Still no luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2013 14:09:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80086#M17252</guid>
      <dc:creator>Grumbler</dc:creator>
      <dc:date>2013-05-20T14:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80087#M17253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The question is straightforward, while the answer is not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input from $ to $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;A B&lt;/P&gt;&lt;P&gt;B C&lt;/P&gt;&lt;P&gt;B D&lt;/P&gt;&lt;P&gt;M A&lt;/P&gt;&lt;P&gt;C E&lt;/P&gt;&lt;P&gt;C B&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table have1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct from from have;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_=1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if 0 then set have (rename=(from=_from to=_to));&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hash h(dataset:'have (rename=(from=_from to=_to))', multidata:'y');&lt;/P&gt;&lt;P&gt;h.definekey('_from');&lt;/P&gt;&lt;P&gt;h.definedata(all:'y');&lt;/P&gt;&lt;P&gt;h.definedone();&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hash h1(ordered:'a');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h1.definekey('new');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h1.definedata('new');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h1.definedone();&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hiter hit('h1');&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain new '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length newvar $50;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do rc=h.find(key:from) by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _to ne from then h1.replace(key:_to, data:_to);&lt;/P&gt;&lt;P&gt;rc=h.find_next(key:from);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;rc=hit.first();&lt;/P&gt;&lt;P&gt;&amp;nbsp; do rc=0 by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; rc=h.find(key:new);&lt;/P&gt;&lt;P&gt;do rc=0 by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _to ne from then h1.replace(key:_to, data:_to);&lt;/P&gt;&lt;P&gt;&amp;nbsp; rc=h.find_next(key:new);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rc=hit.next();&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;do rc=hit.first() by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;newvar=catx(' ',newvar,new);&lt;/P&gt;&lt;P&gt;rc=hit.next();&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;keep from newvar;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 May 2013 19:55:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80087#M17253</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-05-21T19:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80088#M17254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks.&amp;nbsp; it works great.&amp;nbsp; however, there are some examples that this doesn't seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A C&lt;/P&gt;&lt;P&gt;A B&lt;/P&gt;&lt;P&gt;B C&lt;/P&gt;&lt;P&gt;B A&lt;/P&gt;&lt;P&gt;C A&lt;/P&gt;&lt;P&gt;C B&lt;/P&gt;&lt;P&gt;D A&lt;/P&gt;&lt;P&gt;E D&lt;/P&gt;&lt;P&gt;F G&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am thinking it's related to this part of the code declare hash h1(ordered:'a');&lt;/P&gt;&lt;P&gt;the new example works, if i choose "d" instead of "a" order.&lt;/P&gt;&lt;P&gt;is there a way to make order doesn't make any difference?&lt;/P&gt;&lt;P&gt;i don't know enough about hash to figure it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks a bunch.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 04:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80088#M17254</guid>
      <dc:creator>Grumbler</dc:creator>
      <dc:date>2013-05-23T04:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80089#M17255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are right that my previous code is buggy, and it could still be the case for the current one, so let me know how it suits your need. FYI, in term of Hash order direction, it was irrelevant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input from $ to $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;A C&lt;/P&gt;&lt;P&gt;A B&lt;/P&gt;&lt;P&gt;B C&lt;/P&gt;&lt;P&gt;B A&lt;/P&gt;&lt;P&gt;C A&lt;/P&gt;&lt;P&gt;C B&lt;/P&gt;&lt;P&gt;D A&lt;/P&gt;&lt;P&gt;E D&lt;/P&gt;&lt;P&gt;F G&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table have1 as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct from from have;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_=1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if 0 then set have (rename=(from=_from to=_to));&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hash h(dataset:'have (rename=(from=_from to=_to))', multidata:'y');&lt;/P&gt;&lt;P&gt;h.definekey('_from');&lt;/P&gt;&lt;P&gt;h.definedata(all:'y');&lt;/P&gt;&lt;P&gt;h.definedone();&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hash h1(ordered:'a');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h1.definekey('new');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h1.definedata('new');&lt;/P&gt;&lt;P&gt;&amp;nbsp; h1.definedone();&lt;/P&gt;&lt;P&gt;&amp;nbsp; declare hiter hit('h1');&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain new '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ';&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length newvar $50;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do rc=h.find(key:from) by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _to ne from then h1.replace(key:_to, data:_to);&lt;/P&gt;&lt;P&gt;rc=h.find_next(key:from);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do rc=hit.first() by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; rc=h.find(key:new);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do rc=0 by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _to ne from and h1.find(key:_to) ne 0 then do;h1.replace(key:_to, data:_to); rc=hit.first(); go to outer;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else rc=h.find_next(key:new);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; rc=hit.next();&lt;/P&gt;&lt;P&gt;outer: end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do rc=hit.first() by 0 while (rc=0);&lt;/P&gt;&lt;P&gt;newvar=catx(' ',newvar,new);&lt;/P&gt;&lt;P&gt;rc=hit.next();&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;keep from newvar;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 19:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80089#M17255</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-05-23T19:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80090#M17256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks a lot.&amp;nbsp; i have tested many complicated examples.&amp;nbsp; so far, it's working great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one more thing, just getting more complicated.&amp;nbsp; &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&amp;nbsp; i don't suppose you can keep the order of the nodes right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ie, a to b to c.&amp;nbsp; it seems the updated version finds all of them, but in sorted order i believe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 05:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80090#M17256</guid>
      <dc:creator>Grumbler</dc:creator>
      <dc:date>2013-06-10T05:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80091#M17257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am not saying it is impossible, but it is getting strenuous, and honestly, I don't see the value of it.&amp;nbsp; for example,&lt;/P&gt;&lt;P&gt;A C&lt;/P&gt;&lt;P&gt;A F&lt;/P&gt;&lt;P&gt;A B&lt;/P&gt;&lt;P&gt;D E&lt;/P&gt;&lt;P&gt;C D&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What kind of rules you are expecting?&lt;/P&gt;&lt;P&gt;1).&amp;nbsp; C-D-E-F-B, this is to do the streaming until exhaustion, then moving to next one, repeating the process.&lt;/P&gt;&lt;P&gt;2. C-F-B-D-E, this is to show the emerging orders of those values.&lt;/P&gt;&lt;P&gt;And there could be more possible rules depending on the structure of your data.&lt;/P&gt;&lt;P&gt;For 1)&amp;nbsp; you will have the valuable streaming order until being interrupted by the next obs, and you don't know where it happens, therefore you will have trouble identifying the rank of those transferring.&lt;/P&gt;&lt;P&gt;For 2) It may be simply done, but what is value adding to the understanding of your data? It will only be the order of these value showing up from top down.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just my 2 cents,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 16:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80091#M17257</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-06-10T16:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80092#M17258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have SAS/OR licensed you may want to explore PROC BOM as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/orbomug/59689/HTML/default/viewer.htm#bom.htm" title="http://support.sas.com/documentation/cdl/en/orbomug/59689/HTML/default/viewer.htm#bom.htm"&gt;SAS/OR(R) 9.2 User's Guide: Bills of Material Processing&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Jun 2013 16:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80092#M17258</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-06-10T16:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80093#M17259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;unfortunately, i don't have that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2013 03:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80093#M17259</guid>
      <dc:creator>Grumbler</dc:creator>
      <dc:date>2013-06-11T03:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Nodes, Links, &amp; Routes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80094#M17260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i see.&amp;nbsp; it should follow rule 1).&amp;nbsp; so it's not possible to do for this rule?&amp;nbsp; thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Jun 2013 03:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nodes-Links-Routes/m-p/80094#M17260</guid>
      <dc:creator>Grumbler</dc:creator>
      <dc:date>2013-06-11T03:23:16Z</dc:date>
    </item>
  </channel>
</rss>

