<?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 How to make 2 consecutive find() lookups with hash tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-2-consecutive-find-lookups-with-hash-tables/m-p/279694#M56396</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm just beginning to use hash tables and I have the impression that find() only work once per oberservation.&lt;/P&gt;
&lt;P&gt;I don't understand how this come.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: I just found&amp;nbsp;out that rc2=160038&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my hash table declaration&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	if _n_=1 then do;

		***modelvalues ----------------;
		declare hash h1(dataset:'modelData');
		h1.definekey ('Germ', 'Category1', 'Category2', 'AgeGroupDALY', 'Gender') ;
		h1.definedata('Value');
		h1.definedone();
		call missing(Germ, Value, Category1, Category2);
		* e.g. rc=h1.find(KEY:Germ, KEY:"State", KEY:"property", KEY:AgeGroupDALY, KEY:Gender);

	end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm able to find&amp;nbsp;a value, but if I do a second lookup with find() with other keys, 'value' doesn't change like it should be.&lt;/P&gt;
&lt;P&gt;It's like the second find doesn't even work or doesnt override 'value'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		rc=h1.find(KEY:Germ, KEY:Edge, KEY:"Probability", KEY:AgeGroupDALY, KEY:Gender);
		put "value=" value;
		rc2=h1.find(KEY:Germ, KEY:Edge, KEY:"Probability", KEY:"0", KEY:"M");
		put "value=" value;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do I need to close the connection or do something special?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jun 2016 09:08:29 GMT</pubDate>
    <dc:creator>mathias</dc:creator>
    <dc:date>2016-06-23T09:08:29Z</dc:date>
    <item>
      <title>How to make 2 consecutive find() lookups with hash tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-2-consecutive-find-lookups-with-hash-tables/m-p/279694#M56396</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm just beginning to use hash tables and I have the impression that find() only work once per oberservation.&lt;/P&gt;
&lt;P&gt;I don't understand how this come.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT: I just found&amp;nbsp;out that rc2=160038&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my hash table declaration&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	if _n_=1 then do;

		***modelvalues ----------------;
		declare hash h1(dataset:'modelData');
		h1.definekey ('Germ', 'Category1', 'Category2', 'AgeGroupDALY', 'Gender') ;
		h1.definedata('Value');
		h1.definedone();
		call missing(Germ, Value, Category1, Category2);
		* e.g. rc=h1.find(KEY:Germ, KEY:"State", KEY:"property", KEY:AgeGroupDALY, KEY:Gender);

	end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'm able to find&amp;nbsp;a value, but if I do a second lookup with find() with other keys, 'value' doesn't change like it should be.&lt;/P&gt;
&lt;P&gt;It's like the second find doesn't even work or doesnt override 'value'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		rc=h1.find(KEY:Germ, KEY:Edge, KEY:"Probability", KEY:AgeGroupDALY, KEY:Gender);
		put "value=" value;
		rc2=h1.find(KEY:Germ, KEY:Edge, KEY:"Probability", KEY:"0", KEY:"M");
		put "value=" value;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do I need to close the connection or do something special?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2016 09:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-2-consecutive-find-lookups-with-hash-tables/m-p/279694#M56396</guid>
      <dc:creator>mathias</dc:creator>
      <dc:date>2016-06-23T09:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to make 2 consecutive find() lookups with hash tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-make-2-consecutive-find-lookups-with-hash-tables/m-p/279697#M56398</link>
      <description>&lt;PRE&gt;
Remember Put CALL MISSING() before each and every FIND() to avoid the error result.



call missing(Value);  /* &amp;lt;---- No need to call missing KEY variable, Only DATA variable   */
rc=h1.find(KEY:Germ, KEY:Edge, KEY:"Probability", KEY:AgeGroupDALY, KEY:Gender);
put "value=" value;

call missing(Value);
rc2=h1.find(KEY:Germ, KEY:Edge, KEY:"Probability", KEY:"0", KEY:"M");
put "value=" value;

&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2016 08:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-make-2-consecutive-find-lookups-with-hash-tables/m-p/279697#M56398</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-06-23T08:48:44Z</dc:date>
    </item>
  </channel>
</rss>

