<?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 getting the master id ladder like table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23970#M3998</link>
    <description>Hello&lt;BR /&gt;
&lt;BR /&gt;
I have the following table with :&lt;BR /&gt;
&lt;BR /&gt;
master_id  merged_id  merge_request&lt;BR /&gt;
B________A________ 01/01/2010&lt;BR /&gt;
C________B_________02/01/2010&lt;BR /&gt;
D________C_________03/01/2010&lt;BR /&gt;
&lt;BR /&gt;
where some user id where basically referencing the same person&lt;BR /&gt;
and have merged in the base system.&lt;BR /&gt;
&lt;BR /&gt;
How could I create a lookup table that would look like that:&lt;BR /&gt;
&lt;BR /&gt;
master_id  merged_id  &lt;BR /&gt;
D________A &lt;BR /&gt;
D________B &lt;BR /&gt;
D________C&lt;BR /&gt;
&lt;BR /&gt;
The only way I can think to do this would be using a macro?&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
jsg</description>
    <pubDate>Tue, 18 May 2010 16:16:10 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-05-18T16:16:10Z</dc:date>
    <item>
      <title>getting the master id ladder like table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23970#M3998</link>
      <description>Hello&lt;BR /&gt;
&lt;BR /&gt;
I have the following table with :&lt;BR /&gt;
&lt;BR /&gt;
master_id  merged_id  merge_request&lt;BR /&gt;
B________A________ 01/01/2010&lt;BR /&gt;
C________B_________02/01/2010&lt;BR /&gt;
D________C_________03/01/2010&lt;BR /&gt;
&lt;BR /&gt;
where some user id where basically referencing the same person&lt;BR /&gt;
and have merged in the base system.&lt;BR /&gt;
&lt;BR /&gt;
How could I create a lookup table that would look like that:&lt;BR /&gt;
&lt;BR /&gt;
master_id  merged_id  &lt;BR /&gt;
D________A &lt;BR /&gt;
D________B &lt;BR /&gt;
D________C&lt;BR /&gt;
&lt;BR /&gt;
The only way I can think to do this would be using a macro?&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
jsg</description>
      <pubDate>Tue, 18 May 2010 16:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23970#M3998</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-18T16:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: getting the master id ladder like table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23971#M3999</link>
      <description>Hi:&lt;BR /&gt;
  I don't understand your relationships. In the "lookup" table, you have this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
master_id merged_id &lt;BR /&gt;
  D           A &lt;BR /&gt;
  D           B &lt;BR /&gt;
  D           C&lt;BR /&gt;
[/pre]&lt;BR /&gt;
               &lt;BR /&gt;
How does master_id in this table correspond to master_id in the original table?&lt;BR /&gt;
[pre]&lt;BR /&gt;
master_id merged_id merge_request&lt;BR /&gt;
  B          A       01/01/2010&lt;BR /&gt;
  C          B       02/01/2010&lt;BR /&gt;
  D          C       03/01/2010&lt;BR /&gt;
[/pre]&lt;BR /&gt;
  &lt;BR /&gt;
Possible interpretations/combinations/lookups could be:&lt;BR /&gt;
1) master_id on original table matches with master_id on lookup table and merged_id on lookup table becomes new merged_id in output table&lt;BR /&gt;
 &lt;BR /&gt;
2) merged_id on lookup table matches with master_id on original table and master_id on lookup table becomes the new master_id in output table&lt;BR /&gt;
&lt;BR /&gt;
3) merged_id on lookup table matches with merged_id on original table and master_id on lookup table becomes new master_id in output table&lt;BR /&gt;
&lt;BR /&gt;
There are undoubtedly more possibilities. Without any idea of how the lookup table or the original table will be used or what the merge_request date field means or what type of subsequent processing or output report you hopw to see, it is hard to make any recommendations.&lt;BR /&gt;
&lt;BR /&gt;
To me, in the month of January, it lookes like A was merged with B. Then in Feb, it looks like B was merged with C, but does that mean that A was also merged with C, but only for Feb?? Then in March, C was merged with D, does that mean that A and B were also merged into D -- but only for March??? Your lookup table does not distinguish time periods. It looks like you are possibly rolling up all merges to the most recent master_id??? But wouldn't D be the wrong master_id for A in the month of January????&lt;BR /&gt;
 &lt;BR /&gt;
Having some idea of the whole process and how you are using these tables would come in handy.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 18 May 2010 16:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23971#M3999</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-05-18T16:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: getting the master id ladder like table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23972#M4000</link>
      <description>Hello&lt;BR /&gt;
&lt;BR /&gt;
In my actual question id A,B,C and D are all the same user in the system because&lt;BR /&gt;
A  has been merged to B, then B has been set to C, etc.&lt;BR /&gt;
&lt;BR /&gt;
In another table I have transactions for all these user id and I want to associate these transactions with the latest master id.&lt;BR /&gt;
&lt;BR /&gt;
id transaction_type date&lt;BR /&gt;
A JA                     01/02/2010&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
A PU                    01/02/2010&lt;BR /&gt;
B JA                     03/02/2010&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
Should become:&lt;BR /&gt;
&lt;BR /&gt;
id transaction_type date&lt;BR /&gt;
D JA                     01/02/2010&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
D PU                    01/02/2010&lt;BR /&gt;
D JA                     03/02/2010&lt;BR /&gt;
.&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
jsg</description>
      <pubDate>Wed, 19 May 2010 08:36:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23972#M4000</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-19T08:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: getting the master id ladder like table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23973#M4001</link>
      <description>hi, you just need a format.&lt;BR /&gt;
Such as:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc format;&lt;BR /&gt;
  value $fmt&lt;BR /&gt;
           'A','B','C' = 'D';&lt;BR /&gt;
run;&lt;BR /&gt;
..................&lt;BR /&gt;
................&lt;BR /&gt;
format id $fmt.;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 20 May 2010 02:14:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23973#M4001</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-05-20T02:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: getting the master id ladder like table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23974#M4002</link>
      <description>Hi JSG,&lt;BR /&gt;
&lt;BR /&gt;
Is this a one-time run, or will the table need to be updated in the future. &lt;BR /&gt;
&lt;BR /&gt;
Basically you're looking to create what's called a Slowly Changing Dimension.  &lt;BR /&gt;
&lt;BR /&gt;
If its a one time creation the process is different than if there will be updates.  &lt;BR /&gt;
&lt;BR /&gt;
If you have a solution already, I'd be interested in seeing it as well, if not I have a few idea's that may work. &lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Reeza</description>
      <pubDate>Thu, 20 May 2010 21:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/getting-the-master-id-ladder-like-table/m-p/23974#M4002</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2010-05-20T21:18:51Z</dc:date>
    </item>
  </channel>
</rss>

