<?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 Defining a Hash Table with Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Defining-a-Hash-Table-with-Variables/m-p/522962#M142031</link>
    <description>&lt;P&gt;Is there a reason I can't use variables when I am defining a hash table? For example, the code below works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data out_table;
set base_table;
if 0 then set lookup_table;

if _n_=1 then do;

dcl hash h(dataset: 'lookup_table');
h.definekey('Var1');
h.definedata('Var1','Var2');
h.definedone();
end;

rc_h=h.find();
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But THIS doesn't:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table_variable = lookup_table;


data out_table;
set base_table;
if 0 then set &amp;amp;table_variable.;

if _n_=1 then do;

dcl hash h(dataset: '&amp;amp;table_variable.');
h.definekey('Var1');
h.definedata('Var1','Var2');
h.definedone();
end;

rc_h=h.find();
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why not?&lt;/P&gt;</description>
    <pubDate>Thu, 20 Dec 2018 21:17:26 GMT</pubDate>
    <dc:creator>theponcer</dc:creator>
    <dc:date>2018-12-20T21:17:26Z</dc:date>
    <item>
      <title>Defining a Hash Table with Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Defining-a-Hash-Table-with-Variables/m-p/522962#M142031</link>
      <description>&lt;P&gt;Is there a reason I can't use variables when I am defining a hash table? For example, the code below works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data out_table;
set base_table;
if 0 then set lookup_table;

if _n_=1 then do;

dcl hash h(dataset: 'lookup_table');
h.definekey('Var1');
h.definedata('Var1','Var2');
h.definedone();
end;

rc_h=h.find();
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But THIS doesn't:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table_variable = lookup_table;


data out_table;
set base_table;
if 0 then set &amp;amp;table_variable.;

if _n_=1 then do;

dcl hash h(dataset: '&amp;amp;table_variable.');
h.definekey('Var1');
h.definedata('Var1','Var2');
h.definedone();
end;

rc_h=h.find();
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why not?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 21:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Defining-a-Hash-Table-with-Variables/m-p/522962#M142031</guid>
      <dc:creator>theponcer</dc:creator>
      <dc:date>2018-12-20T21:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Defining a Hash Table with Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Defining-a-Hash-Table-with-Variables/m-p/522964#M142032</link>
      <description>&lt;P&gt;Macro variables will not resolve in singe quotes . Try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let table_variable = lookup_table;


data out_table;
set base_table;
if 0 then set &amp;amp;table_variable.;

if _n_=1 then do;

dcl hash h(dataset: "&amp;amp;table_variable.");
h.definekey('Var1');
h.definedata('Var1','Var2');
h.definedone();
end;

rc_h=h.find();
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Dec 2018 21:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Defining-a-Hash-Table-with-Variables/m-p/522964#M142032</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-20T21:21:05Z</dc:date>
    </item>
  </channel>
</rss>

