<?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: Element of hash object in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241973#M44888</link>
    <description>&lt;P&gt;You have fixed a typo, which is good, but that was not what I meant. Now challenge yourself, why your code does not give you any output? if you check 'num', it has the value of 19.&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jan 2016 02:56:08 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2016-01-06T02:56:08Z</dc:date>
    <item>
      <title>Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241934#M44880</link>
      <description>&lt;P&gt;How to retrieve the particular element of hash object , let's say 10th element from hash object of sashelp.class?&lt;/P&gt;&lt;PRE&gt;data work.test;
	if 0 then
		set sashelp.class;

	if _n_=1 then
		do;
			dcl hash h(dataset:'sashelp.class',ordered:'A',multidata&amp;amp;colon;'yes');
  		    dcl hiter hi('h');
			h.definekey('Name');
	        h.definedata(all:'y');
			h.definedone();
		end;
      /*rc=h.output(dataset:'work.out');*/
      rc=hi.first();
	  rc1=hi.next();
	  put rc;
	  put rc1;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jan 2016 22:43:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241934#M44880</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-01-05T22:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241953#M44882</link>
      <description>&lt;P&gt;You will need to count yourself in this case, unless you have embedded a counter when loading into the Hash.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data work.test;
	if 0 then
		set sashelp.class;

	if _n_=1 then
		do;
			dcl hash h(dataset:'sashelp.class',ordered:'A',multidata&amp;amp;colon;'yes');
			dcl hiter hi('h');
			h.definekey('Name');
	h.definedata(all:
			'y');
			h.definedone();
		end;

	do rc=hi.first() by 0 while (rc=0);
		n+1;

		if n=10 then
			do;
				output;
				stop;
			end;

		rc=hi.next();
	end;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Jan 2016 00:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241953#M44882</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-01-06T00:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241954#M44883</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4877"&gt;@Haikuo﻿&lt;/a&gt;&amp;nbsp;Thanks. I was trying if I could use "h.num_items" method to get the desired result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data work.test;
	if 0 then
		set sashelp.class;

	if _n_=1 then
		do;
			dcl hash h(dataset:'sashelp.class',ordered:'A',multidata&amp;amp;colon;'yes');
			dcl hiter hi('h');
			h.definekey('Name');
	h.definedata(all:
			'y');
			h.definedone();
		end;&lt;BR /&gt;num=h.num_items;&lt;BR /&gt;rc=hi.first();&lt;BR /&gt;  do  i= 1 to num;&lt;BR /&gt;   if i=10 then output;&lt;BR /&gt;      stop;&lt;BR /&gt;  rc=hi.next();&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2016 02:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241954#M44883</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-01-06T02:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241955#M44884</link>
      <description>&lt;P&gt;Yes, you CAN use h.num_items. Fix your buggy code first before you can see it.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2016 01:42:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241955#M44884</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-01-06T01:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241968#M44886</link>
      <description>&lt;P&gt;Check SETCUR() method. But you need a index variable for it .&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;data class;
 set sashelp.class;
 n+1;
run;
data work.test;
	if _n_=1 then do;
	if 0 then set class;
			declare hash h(dataset:'class',ordered:'A');
  		    declare hiter hi('h');
			h.definekey('n');
	        h.definedata(all:'y');
			h.definedone();
	end;
 rc=hi.setcur(key:10);
 do while(rc=0);
  output;
  rc=hi.next();
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Jan 2016 02:32:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241968#M44886</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-06T02:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241973#M44888</link>
      <description>&lt;P&gt;You have fixed a typo, which is good, but that was not what I meant. Now challenge yourself, why your code does not give you any output? if you check 'num', it has the value of 19.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2016 02:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241973#M44888</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-01-06T02:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241974#M44889</link>
      <description>&lt;P&gt;Thanks, Haikuo. &amp;nbsp;I will try to figure it out.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2016 02:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241974#M44889</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-01-06T02:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241975#M44890</link>
      <description>&lt;P&gt;Thanks, Ksharp. &amp;nbsp;It gives 10 elements of hash table. Was looking for only 10th element.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2016 03:06:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241975#M44890</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-01-06T03:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241980#M44893</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
 set sashelp.class;
 n+1;
run;
data work.test;
	if _n_=1 then do;
	if 0 then set class;
			declare hash h(dataset:'class',ordered:'A');
  		    declare hiter hi('h');
			h.definekey('n');
	        h.definedata(all:'y');
			h.definedone();
	end;
 rc=hi.setcur(key:10);

  output;
stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Jan 2016 03:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/241980#M44893</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-01-06T03:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Element of hash object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/242043#M44912</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp﻿&lt;/a&gt;, If you already have the index loaded, you don't need hiter at all. Just 'rc=h.find(key:10)' will be sufficient.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jan 2016 15:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Element-of-hash-object/m-p/242043#M44912</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2016-01-06T15:16:46Z</dc:date>
    </item>
  </channel>
</rss>

