<?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 Hash Programming - Variable is not an Object in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hash-Programming-Variable-is-not-an-Object/m-p/523427#M142196</link>
    <description>&lt;P&gt;I am trying to do a hash merge. However, I keep getting an error that says "ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase.&lt;BR /&gt;ERROR 557-185: Variable test is not an object."&lt;/P&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 n=0 then set lookup_table;

if _n_ = 1 then do;
dcl hash test (dataset:'lookup_table');
	test.definekey('key');
	test.definedata('key','Var1');
	test.definedone();


rc_test=test.find();


run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Anyone have any ideas what I am doing wrong? When I change&amp;nbsp;the hash object&amp;nbsp;to "test_t" it works.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 24 Dec 2018 18:37:17 GMT</pubDate>
    <dc:creator>theponcer</dc:creator>
    <dc:date>2018-12-24T18:37:17Z</dc:date>
    <item>
      <title>Hash Programming - Variable is not an Object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Programming-Variable-is-not-an-Object/m-p/523427#M142196</link>
      <description>&lt;P&gt;I am trying to do a hash merge. However, I keep getting an error that says "ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase.&lt;BR /&gt;ERROR 557-185: Variable test is not an object."&lt;/P&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 n=0 then set lookup_table;

if _n_ = 1 then do;
dcl hash test (dataset:'lookup_table');
	test.definekey('key');
	test.definedata('key','Var1');
	test.definedone();


rc_test=test.find();


run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Anyone have any ideas what I am doing wrong? When I change&amp;nbsp;the hash object&amp;nbsp;to "test_t" it works.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Dec 2018 18:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Programming-Variable-is-not-an-Object/m-p/523427#M142196</guid>
      <dc:creator>theponcer</dc:creator>
      <dc:date>2018-12-24T18:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Programming - Variable is not an Object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Programming-Variable-is-not-an-Object/m-p/523444#M142202</link>
      <description>&lt;P&gt;Do you have a variable named TEST in either base_table or lookup_table?&amp;nbsp; If so then the SAS compiler already has a use for that name, and you can't&amp;nbsp;also use the name test for another purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;True, when you use TEST as the name of a hash object, you&amp;nbsp;could&amp;nbsp;think of it as a "variable".&amp;nbsp; But it's a variable&amp;nbsp;whose value is a pointer to an object, which in turn contains all the data items and keys loaded into the hash object.&amp;nbsp; That makes it a special kind of variable (i.e. not numeric or character).&amp;nbsp; And unlike other variables created within a data step, it is automatically "retained" across observations.&amp;nbsp; That's why you commonly see the INSTANTIATION of a hash object inside something like an "IF _N_ then do;" group of statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll let you look up the concept of hash object instantiation (as opposed to declaration), if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Also, you appear to be missing an "END:" statement after the definedone method, prior to the find method.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Dec 2018 22:43:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Programming-Variable-is-not-an-Object/m-p/523444#M142202</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-12-24T22:43:31Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Programming - Variable is not an Object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Programming-Variable-is-not-an-Object/m-p/524134#M142495</link>
      <description>&lt;P&gt;Yup, that was the problem! I figured that was the issue, but couldn't figure out why SAS would be considering the hash table to be a variable name. Thanks for pointing me towards instantiation!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 17:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Programming-Variable-is-not-an-Object/m-p/524134#M142495</guid>
      <dc:creator>theponcer</dc:creator>
      <dc:date>2019-01-02T17:29:20Z</dc:date>
    </item>
  </channel>
</rss>

