<?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: SAS Teradata join in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Teradata-join/m-p/461540#M117429</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input (RecordNo ID1 ID2 ID3) ($);
cards;
001 A001 A112 A511
002 A005 A234 A345
003 A002 A123 A112
004 A003 A004 A234
;
run;

data b;
input (Id Name) ($);
cards;
A001 Rick
A002 David
A003 Ron
A004 Pat
A005 Tom
;
run;

data want;
 if _n_=1 then do;
  if 0 then set b;
  declare hash h(dataset:'b');
  h.definekey('id');
  h.definedata('name');
  h.definedone();
 end;
 set a;
 array x{*} $ 32 name1-name3;
 array y{*} $ 32 id1-id3;

 do i=1 to dim(x);
   call missing(name);
   id=y{i};
   rc=h.find();
   x{i}=name;
 end;

 drop i id name rc;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 11 May 2018 13:55:46 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-05-11T13:55:46Z</dc:date>
    <item>
      <title>SAS Teradata join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Teradata-join/m-p/461535#M117428</link>
      <description>I have a SAS data set as follows.&lt;BR /&gt;RecordNo ID1 ID2 ID3&lt;BR /&gt;001 A001 A112 A511&lt;BR /&gt;002 A005 A234 A345&lt;BR /&gt;003 A002 A123 A112&lt;BR /&gt;004 A003 A004 A234&lt;BR /&gt;&lt;BR /&gt;I need to create another dataset from the above dataset by replacing ID1, ID2, ID3 by name1, name2, name3 resp. But the lookup for id and name is in teradata table like below&lt;BR /&gt;Id Name&lt;BR /&gt;A001 Rick&lt;BR /&gt;A002 David&lt;BR /&gt;A003 Ron&lt;BR /&gt;A004 Pat&lt;BR /&gt;A005 Tom&lt;BR /&gt;&lt;BR /&gt;So I need to use this teradata table to create the data set loke below.&lt;BR /&gt;RecordNo Name1 Name2 Name3&lt;BR /&gt;001 Rick Sam Nick&lt;BR /&gt;002 Tom Geoff Kate&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What can be the best or efficient way to get those values from the teradata table? Any help is appreciated</description>
      <pubDate>Fri, 11 May 2018 13:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Teradata-join/m-p/461535#M117428</guid>
      <dc:creator>nickspencer</dc:creator>
      <dc:date>2018-05-11T13:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Teradata join</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Teradata-join/m-p/461540#M117429</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input (RecordNo ID1 ID2 ID3) ($);
cards;
001 A001 A112 A511
002 A005 A234 A345
003 A002 A123 A112
004 A003 A004 A234
;
run;

data b;
input (Id Name) ($);
cards;
A001 Rick
A002 David
A003 Ron
A004 Pat
A005 Tom
;
run;

data want;
 if _n_=1 then do;
  if 0 then set b;
  declare hash h(dataset:'b');
  h.definekey('id');
  h.definedata('name');
  h.definedone();
 end;
 set a;
 array x{*} $ 32 name1-name3;
 array y{*} $ 32 id1-id3;

 do i=1 to dim(x);
   call missing(name);
   id=y{i};
   rc=h.find();
   x{i}=name;
 end;

 drop i id name rc;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 May 2018 13:55:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Teradata-join/m-p/461540#M117429</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-05-11T13:55:46Z</dc:date>
    </item>
  </channel>
</rss>

