<?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: DS2 hash and hash iterator packages in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/251723#M56754</link>
    <description>&lt;P&gt;Ok, this works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ds2;
   data foo (overwrite=yes);
      dcl char(9) stock;
      dcl double open close;
      dcl package hash h(8, '{SELECT stock,"open","close" FROM lookup}'); * so why does this fail??? ;
      dcl package hiter hi('h');
      method init();
         dcl double rc;
         rc = h.defineKey('stock');
         rc = h.defineData('open');
         rc = h.defineData('close');
         rc = h.defineDone();
      end;
      method run();
         dcl double rc;
         set fact;
         rc = hi.first();
         do while(rc=0);
            output;
            rc = hi.next();
         end;
      end;
   enddata;
   run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;"open" and "close" are not listed as reserved words in Ch 21 "DS2 Reserved Words" of the DS2 Language Reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, they are listed as reserved words in the FedSQL documentation: &amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/fedsqlref/67364/HTML/default/viewer.htm#p0x0k1rlx0l7e4n1ptngog3ce4jp.htm." target="_blank"&gt;http://support.sas.com/documentation/cdl/en/fedsqlref/67364/HTML/default/viewer.htm#p0x0k1rlx0l7e4n1ptngog3ce4jp.htm.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A link to that documentation from Ch 21 would be useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS R&amp;amp;D - would it be that hard to say something like "open is a reserved word" in the error message??? &amp;nbsp;Clear and consise error messages make your customers' and Tech Support's life a lot easier!&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2016 05:13:21 GMT</pubDate>
    <dc:creator>ScottBass</dc:creator>
    <dc:date>2016-02-23T05:13:21Z</dc:date>
    <item>
      <title>DS2 hash and hash iterator packages</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201767#M50401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am looking for an example on how to use a hash and hash iterator to iterate through a data set inside a DS2 data program. As practical application I would like to build the Cartesian product of two tables.&lt;/P&gt;&lt;P&gt;Each of the tables is a list of ID and Value and I want in face to end up with a data set containing all possible pairs of these 2 sets of Value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried something like below but is not working. It looks like &lt;STRONG&gt;rc=hi.first();&lt;/STRONG&gt; returns an error code &lt;STRONG&gt;rc=4&lt;/STRONG&gt; but I cannot find anywhere what that means.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc ds2;&lt;BR /&gt;data one (overwrite=YES);&lt;BR /&gt; method run();&lt;BR /&gt;&amp;nbsp; set post.workPC (RENAME=(Value=Value1 TblID=TblID1));&lt;BR /&gt; end;&lt;BR /&gt;enddata;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data two (overwrite=YES);&lt;BR /&gt; method run();&lt;BR /&gt;&amp;nbsp; set post.workPC (RENAME=(Value=Value2 TblID=TblID2));&lt;BR /&gt;&amp;nbsp; if TblID2 gt 1 then output;&lt;BR /&gt; end;&lt;BR /&gt;enddata;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data prodcart (overwrite=Yes);&lt;BR /&gt;declare double TblID2 rc;&lt;BR /&gt;declare char(10) Value2;&lt;/P&gt;&lt;P&gt;declare package hash h ('two');&lt;BR /&gt;declare package hiter hi('h');&lt;/P&gt;&lt;P&gt;method init();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rc = h.defineKey('TblID2');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = h.defineData('Value2');&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = h.defineDone();&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;method run();&lt;BR /&gt; set one;&lt;BR /&gt; rc=hi.first();&lt;BR /&gt; put TblID2 Value2 TblID1 Value1;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2015 18:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201767#M50401</guid>
      <dc:creator>gnanau</dc:creator>
      <dc:date>2015-04-22T18:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: DS2 hash and hash iterator packages</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201768#M50402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data class;&lt;/P&gt;&lt;P&gt;set sashelp.class;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data altclass;&lt;/P&gt;&lt;P&gt;set sashelp.class;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc ds2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data foo (overwrite=yes);&lt;/P&gt;&lt;P&gt;dcl nchar(32) altname;&lt;/P&gt;&lt;P&gt;dcl package hash h(8, '{SELECT name as altname FROM altclass}');&lt;/P&gt;&lt;P&gt;dcl package hiter hi('h');&lt;/P&gt;&lt;P&gt;method init();&lt;/P&gt;&lt;P&gt;dcl double rc;&lt;/P&gt;&lt;P&gt;rc = h.defineKey('altname');&lt;/P&gt;&lt;P&gt;rc = h.defineData('altname');&lt;/P&gt;&lt;P&gt;rc = h.defineDone();&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;method run();&lt;/P&gt;&lt;P&gt;dcl double rc;&lt;/P&gt;&lt;P&gt;set class;&lt;/P&gt;&lt;P&gt;rc = hi.first();&lt;/P&gt;&lt;P&gt;do while(rc=0);&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;rc = hi.next();&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;enddata;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Apr 2015 21:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201768#M50402</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2015-04-22T21:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: DS2 hash and hash iterator packages</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201769#M50403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;your specific issue is that you are not declaring the hash with a valid syntax (you are missing a definition for hashexp), apparently this does not cause any kind of error to be produced, you just get a empty hash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/viewer.htm#n0qpaav3a488wjn1ishk8ump7j1g.htm" title="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/viewer.htm#n0qpaav3a488wjn1ishk8ump7j1g.htm"&gt;SAS(R) 9.4 DS2 Language Reference, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;H4 class="xis-title" style="margin: 1.4em 0 -1em; font-size: 14.3999996185303px; font-family: 'Source Sans Pro', arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; color: #5d6065; background-color: #ffffff;"&gt;Form 1:&lt;/H4&gt;&lt;P class="xis-syntaxSimple" style="font-family: 'Source Sans Pro', arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; margin-top: 1.4em; color: #000000; font-size: 14.3999996185303px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt;&lt;SPAN class="xis-keyword" style="font-weight: 600;"&gt;DECLARE PACKAGE HASH&lt;/SPAN&gt; &lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p1td1ytqg2tbaun13apvdzlujpxg" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: variable"&gt;variable&lt;/A&gt;&lt;/SPAN&gt; ( );&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;H4 class="xis-title" style="margin: 1.4em 0 -1em; font-size: 14.3999996185303px; font-family: 'Source Sans Pro', arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; color: #5d6065; background-color: #ffffff;"&gt;Form 2:&lt;/H4&gt;&lt;P class="xis-syntaxSimple" style="font-family: 'Source Sans Pro', arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; margin-top: 1.4em; color: #000000; font-size: 14.3999996185303px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt;&lt;SPAN class="xis-keyword" style="font-weight: 600;"&gt;DECLARE PACKAGE HASH&lt;/SPAN&gt; &lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p1td1ytqg2tbaun13apvdzlujpxg" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: variable"&gt;variable&lt;/A&gt;&lt;/SPAN&gt; (&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p1d9y4k69tnqhun1m3p5119gna98" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: hashexp"&gt;hashexp&lt;/A&gt;&lt;/SPAN&gt;, {'&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n03g650kjkvve5n1xwvf3u5hcks5" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'datasource'"&gt;datasource&lt;/A&gt;&lt;/SPAN&gt;' | '\{&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p0a6ellvidy8bcn1vpg2rb7nw2wa" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: {sql-text}"&gt;sql-text&lt;/A&gt;&lt;/SPAN&gt;\}'},&lt;BR /&gt;'&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n10idbkqhm0ij3n1p8lph2kgcs65" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'ordered'"&gt;ordered&lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n01m8ek9i3doegn1unh4qpr33cm9" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'duplicate'"&gt;duplicate &lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p06um1nikpyyxfn1ng0n8cdignq4" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'suminc'"&gt;suminc&lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p0ysl2az68t4lrn1ibs1i2qsyaqp" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'multidata'"&gt;multidata&lt;/A&gt;&lt;/SPAN&gt;');&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;H4 class="xis-title" style="margin: 1.4em 0 -1em; font-size: 14.3999996185303px; font-family: 'Source Sans Pro', arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; color: #5d6065; background-color: #ffffff;"&gt;Form 3:&lt;/H4&gt;&lt;P class="xis-syntaxSimple" style="font-family: 'Source Sans Pro', arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; margin-top: 1.4em; color: #000000; font-size: 14.3999996185303px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt;&lt;SPAN class="xis-keyword" style="font-weight: 600;"&gt;DECLARE PACKAGE HASH&lt;/SPAN&gt; &lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p1td1ytqg2tbaun13apvdzlujpxg" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: variable"&gt;variable&lt;/A&gt;&lt;/SPAN&gt; ( \[&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n1rqzxg4zi9elon1tnqyu2fi8v0w" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: [keys]"&gt;keys&lt;/A&gt;&lt;/SPAN&gt;\], \[&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p15fhw4gwisr1in1hrpso69xe3dx" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: [data]"&gt;data&lt;/A&gt;&lt;/SPAN&gt;\], &lt;SPAN class="xis-argOptional"&gt;[&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p1d9y4k69tnqhun1m3p5119gna98" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: hashexp"&gt;hashexp&lt;/A&gt;&lt;/SPAN&gt;,&lt;BR /&gt;{'&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n03g650kjkvve5n1xwvf3u5hcks5" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'datasource'"&gt;datasource&lt;/A&gt;&lt;/SPAN&gt;' | '\{&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p0a6ellvidy8bcn1vpg2rb7nw2wa" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: {sql-text}"&gt;sql-text&lt;/A&gt;&lt;/SPAN&gt;\}'}, '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n10idbkqhm0ij3n1p8lph2kgcs65" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'ordered'"&gt;ordered&lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n01m8ek9i3doegn1unh4qpr33cm9" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'duplicate'"&gt;duplicate &lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p06um1nikpyyxfn1ng0n8cdignq4" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'suminc'"&gt;suminc&lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p0ysl2az68t4lrn1ibs1i2qsyaqp" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'multidata'"&gt;multidata&lt;/A&gt;&lt;/SPAN&gt;']&lt;/SPAN&gt;);&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;H4 class="xis-title" style="margin: 1.4em 0 -1em; font-size: 14.3999996185303px; font-family: 'Source Sans Pro', arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; color: #5d6065; background-color: #ffffff;"&gt;Form 4:&lt;/H4&gt;&lt;P class="xis-syntaxSimple" style="font-family: 'Source Sans Pro', arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; margin-top: 1.4em; color: #000000; font-size: 14.3999996185303px; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt;&lt;SPAN class="xis-keyword" style="font-weight: 600;"&gt;DECLARE PACKAGE HASH&lt;/SPAN&gt; &lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p1td1ytqg2tbaun13apvdzlujpxg" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: variable"&gt;variable&lt;/A&gt;&lt;/SPAN&gt; ( \[&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n1rqzxg4zi9elon1tnqyu2fi8v0w" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: [keys]"&gt;keys&lt;/A&gt;&lt;/SPAN&gt;\], &lt;SPAN class="xis-argOptional"&gt;[&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p1d9y4k69tnqhun1m3p5119gna98" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: hashexp"&gt;hashexp&lt;/A&gt;&lt;/SPAN&gt;, {'&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n03g650kjkvve5n1xwvf3u5hcks5" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'datasource'"&gt;datasource&lt;/A&gt;&lt;/SPAN&gt;' | '\{&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p0a6ellvidy8bcn1vpg2rb7nw2wa" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: {sql-text}"&gt;sql-text&lt;/A&gt;&lt;/SPAN&gt;\}'},&lt;BR /&gt;'&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n10idbkqhm0ij3n1p8lph2kgcs65" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'ordered'"&gt;ordered&lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#n01m8ek9i3doegn1unh4qpr33cm9" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'duplicate'"&gt;duplicate &lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p06um1nikpyyxfn1ng0n8cdignq4" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'suminc'"&gt;suminc&lt;/A&gt;&lt;/SPAN&gt;', '&lt;SPAN class="xis-userSuppliedSyntaxValue" style="font-style: italic;"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/ds2ref/68056/HTML/default/n0qpaav3a488wjn1ishk8ump7j1g.htm#p0ysl2az68t4lrn1ibs1i2qsyaqp" style="font-size: 14.3999996185303px; text-decoration: underline; color: #0e66ba;" title="Description of syntax: 'multidata'"&gt;multidata&lt;/A&gt;&lt;/SPAN&gt;']&lt;/SPAN&gt;);&lt;/DIV&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt; &lt;/DIV&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt; &lt;/DIV&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt; &lt;/DIV&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt; &lt;/DIV&gt;&lt;DIV class="xis-syntaxLevel" style="margin-top: 0.6em;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 02:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201769#M50403</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2015-04-23T02:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: DS2 hash and hash iterator packages</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201770#M50404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, you are right, &lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="2645" data-externalid="" data-presence="null" data-userid="733023" data-username="FriedEgg" href="https://communities.sas.com/people/FriedEgg" id="jive-73302345200829060113186"&gt;FriedEgg&lt;/A&gt; !&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;Thank you very much...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know if I can find anywhere what different values for the return code mean? In my case I was getting rc=4 but I cannot seem to find anywhere what these individual codes are...&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 20:32:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201770#M50404</guid>
      <dc:creator>gnanau</dc:creator>
      <dc:date>2015-04-23T20:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: DS2 hash and hash iterator packages</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201771#M50405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The return codes are not documented, to my knowledge.&amp;nbsp; An appropriate error message should be displayed if you exclude the rc=, if it behaves like the hash object in non-ds2 data step.&amp;nbsp; For the `first` method basic meaning is: RC=0 = success, RC &lt;SPAN style="color: #545454; font-family: arial, sans-serif; font-size: small; background-color: #ffffff;"&gt;≠ 0 = failure.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2015 21:52:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201771#M50405</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2015-04-23T21:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: DS2 hash and hash iterator packages</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201772#M50406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 00:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/201772#M50406</guid>
      <dc:creator>gnanau</dc:creator>
      <dc:date>2015-04-24T00:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: DS2 hash and hash iterator packages</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/251721#M56753</link>
      <description>&lt;P&gt;I tried the tiniest of variations of this, as follows:&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;
run;
data altclass;
   set sashelp.class;
run;
proc ds2;
   data foo (overwrite=yes);
      dcl char(32) altname;
      dcl package hash h(8, '{SELECT name as altname,age,sex FROM altclass}');
      dcl package hiter hi('h');
      method init();
         dcl double rc;
         rc = h.defineKey('altname');
         rc = h.defineData('altname');
         rc = h.defineDone();
      end;
      method run();
         dcl double rc;
         set class;
         rc = hi.first();
         do while(rc=0);
            output;
            rc = hi.next();
         end;
      end;
   enddata;
   run;
quit;
data &amp;amp;syslast;
   set &amp;amp;syslast;
run;
data foo;
   set foo;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That works, although it's "irritating" that proc ds2 does not properly set &amp;amp;syslast.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fact (keep=stock where=(stock='IBM'));
   set sashelp.stocks;
run;
data lookup;
   set sashelp.stocks;
run;
* check the sql - it works ;
proc sql;
   SELECT stock,open,close FROM lookup;
quit;
proc ds2;
   data foo (overwrite=yes);
      dcl char(9) stock;
      dcl double open close;
      dcl package hash h(8, '{SELECT stock,open,close FROM lookup}'); * so why does this fail??? ;
      dcl package hiter hi('h');
      method init();
         dcl double rc;
         rc = h.defineKey('stock');
         rc = h.defineData('open');
         rc = h.defineData('close');
         rc = h.defineDone();
      end;
      method run();
         dcl double rc;
         set fact;
         rc = hi.first();
         do while(rc=0);
            output;
            rc = hi.next();
         end;
      end;
   enddata;
   run;
quit;
data &amp;amp;syslast;
   set &amp;amp;syslast;
run;
data foo;
   set foo;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But this fails:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: Syntax error at or near "open"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: Unable to prepare statement for hash data source {SELECT stock,open,close FROM lookup}.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: Error reported by DS2 package d2hash:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: Hash data source load failed.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: Fatal run-time error.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: General error&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Can anyone translate this error message?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 05:03:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/251721#M56753</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2016-02-23T05:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: DS2 hash and hash iterator packages</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/251723#M56754</link>
      <description>&lt;P&gt;Ok, this works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc ds2;
   data foo (overwrite=yes);
      dcl char(9) stock;
      dcl double open close;
      dcl package hash h(8, '{SELECT stock,"open","close" FROM lookup}'); * so why does this fail??? ;
      dcl package hiter hi('h');
      method init();
         dcl double rc;
         rc = h.defineKey('stock');
         rc = h.defineData('open');
         rc = h.defineData('close');
         rc = h.defineDone();
      end;
      method run();
         dcl double rc;
         set fact;
         rc = hi.first();
         do while(rc=0);
            output;
            rc = hi.next();
         end;
      end;
   enddata;
   run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;"open" and "close" are not listed as reserved words in Ch 21 "DS2 Reserved Words" of the DS2 Language Reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, they are listed as reserved words in the FedSQL documentation: &amp;nbsp;&lt;A href="http://support.sas.com/documentation/cdl/en/fedsqlref/67364/HTML/default/viewer.htm#p0x0k1rlx0l7e4n1ptngog3ce4jp.htm." target="_blank"&gt;http://support.sas.com/documentation/cdl/en/fedsqlref/67364/HTML/default/viewer.htm#p0x0k1rlx0l7e4n1ptngog3ce4jp.htm.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A link to that documentation from Ch 21 would be useful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS R&amp;amp;D - would it be that hard to say something like "open is a reserved word" in the error message??? &amp;nbsp;Clear and consise error messages make your customers' and Tech Support's life a lot easier!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 05:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/DS2-hash-and-hash-iterator-packages/m-p/251723#M56754</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2016-02-23T05:13:21Z</dc:date>
    </item>
  </channel>
</rss>

