<?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: How do you expand hierarchal data into a simple lookup in SAS EG? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796119#M40236</link>
    <description>What is the rationale behind the macro requirement? This is usually a hash solution, not macros so curious as to the logic behind that requirement.</description>
    <pubDate>Mon, 14 Feb 2022 19:30:10 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-02-14T19:30:10Z</dc:date>
    <item>
      <title>How do you expand hierarchal data into a simple lookup in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796104#M40235</link>
      <description>&lt;P&gt;I have the following Dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data WORK.have;&lt;BR /&gt;Length EmpName $100. ManagerName $100.;&lt;BR /&gt;Infile datalines delimiter='#';&lt;BR /&gt;input EmpID ManagerID EmpName $ ManagerName $;&lt;BR /&gt;datalines;&lt;BR /&gt;1#4#WALTER WHITE#GUS FRING&lt;BR /&gt;2#1#JESSE PINKMAN#WALTER WHITE&lt;BR /&gt;3#1#SAUL GOODNAM#WALTER WHITE&lt;BR /&gt;4#5#GUS FRING#ELADIO VUENTE&lt;BR /&gt;5#5#ELADIO VUENTE#ELADIO VUENTE&lt;BR /&gt;6#2#SKINNY PETE#JESSE PINKMAN&lt;BR /&gt;7#2#COMBO#JESSE PINKMAN&lt;BR /&gt;;&lt;BR /&gt;run;
&lt;/PRE&gt;
&lt;P&gt;Is there a quick macro script that will find all children (if any) from the table based on EmpID / ManagerID hierarchy and produce the following output?:&lt;/P&gt;
&lt;PRE&gt;data WORK.Want;
Length EmpName $100. ManagerName $100.;
Infile datalines delimiter='#';
input EmpName $ ManagerName $ Level;
datalines;
WALTER WHITE#WALTER WHITE#1
JESSE PINKMAN#WALTER WHITE#2
SKINNY PETE#WALTER WHITE#3
COMBO#WALTER WHITE#3
SAUL GOODNAM#WALTER WHITE#2
JESSE PINKMAN#JESSE PINKMAN#1
SKINNY PETE#JESSE PINKMAN#2
COMBO#JESSE PINKMAN#2
SAUL GOODNAM#SAUL GOODNAM#1
GUS FRING#GUS FRING#1
WALTER WHITE#GUS FRING#2
JESSE PINKMAN#GUS FRING#3
SKINNY PETE#GUS FRING#4
COMBO#GUS FRING#4
SAUL GOODNAM#GUS FRING#3
ELADIO VUENTE#ELADIO VUENTE#1
GUS FRING#ELADIO VUENTE#2
WALTER WHITE#ELADIO VUENTE#3
JESSE PINKMAN#ELADIO VUENTE#4
SKINNY PETE#ELADIO VUENTE#5
COMBO#ELADIO VUENTE#5
SAUL GOODNAM#ELADIO VUENTE#4
SKINNY PETE#SKINNY PETE#1
COMBO#COMBO#1

;
run;&lt;/PRE&gt;
&lt;P&gt;Essentially expanding it out to a simple lookup table. I'm somewhat new to macros do I'm not too sure where to begin.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 18:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796104#M40235</guid>
      <dc:creator>SASAlex101</dc:creator>
      <dc:date>2022-02-14T18:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do you expand hierarchal data into a simple lookup in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796119#M40236</link>
      <description>What is the rationale behind the macro requirement? This is usually a hash solution, not macros so curious as to the logic behind that requirement.</description>
      <pubDate>Mon, 14 Feb 2022 19:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796119#M40236</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-02-14T19:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you expand hierarchal data into a simple lookup in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796206#M40240</link>
      <description>I would be in favor of seeing the "Hash" solution. I mentioned macros because I am ignorantly assuming there isnt't any other clever way to solve the problem in SaS.</description>
      <pubDate>Tue, 15 Feb 2022 06:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796206#M40240</guid>
      <dc:creator>SASAlex101</dc:creator>
      <dc:date>2022-02-15T06:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do you expand hierarchal data into a simple lookup in SAS EG?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796208#M40241</link>
      <description>Macros are merely a way to generate regular SAS code. They arent anything different or special. I would suggest using a RETAIN statement.</description>
      <pubDate>Tue, 15 Feb 2022 06:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-you-expand-hierarchal-data-into-a-simple-lookup-in-SAS-EG/m-p/796208#M40241</guid>
      <dc:creator>AlanC</dc:creator>
      <dc:date>2022-02-15T06:32:44Z</dc:date>
    </item>
  </channel>
</rss>

