<?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: add column for output method Hash Object in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860129#M339813</link>
    <description>&lt;P&gt;Loading and then writing a hash table is still a read/write operation so for your use case wouldn't offer any advantage over a simple data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the hash object offers often real advantages for lookups as it helps to avoid sorts.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2023 11:43:43 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2023-02-22T11:43:43Z</dc:date>
    <item>
      <title>add column for output method Hash Object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860107#M339801</link>
      <description>&lt;P&gt;Good morning. I would like to use the "output" method of hash sas, but I need to add the "key" column and display it on the "class_hash" output dataset. I can't figure out how to do it. I give the example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data large;
   if 0 then set sashelp.class;
   declare hash obj(dataset: 'sashelp.class', multidata:'y');
   obj.definekey ("name" );
   obj.defineData(all:'yes');
   obj.definedone();
   length key $ 200;
   key = catt(name,sex);
   obj.output(dataset:'class_hash');
   stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Mario&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 10:17:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860107#M339801</guid>
      <dc:creator>mariopellegrini</dc:creator>
      <dc:date>2023-02-22T10:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: add column for output method Hash Object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860110#M339803</link>
      <description>&lt;P&gt;The output method can only output what's in the hash defined as data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The hash key column name is with all:"yes" also part of the data and will be included.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column key which you create in your SAS data step is not in the hash table and though not available when writing the hash table in memory to disk.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure if that's going to be of any use for your real use case but below one option how to add another variable to the hash.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data v_demo / view=v_demo;
  set sashelp.class;
   length key $ 200;
   key = catt(name,sex);
run;

data large;
   if 0 then set v_demo;
   declare hash obj(dataset: 'v_demo', multidata:'y');
   obj.definekey ("name" );
   obj.defineData(all:'yes');
   obj.definedone();
   length key $ 200;
   key = catt(name,sex);
   obj.output(dataset:'class_hash');
   stop;
run;

proc print data=class_hash;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 10:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860110#M339803</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-22T10:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: add column for output method Hash Object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860126#M339810</link>
      <description>&lt;P&gt;Thank you, but this way I don't get any advantage in terms of processing time. I was hoping you could save processing time compared to a simple data or proc sql step, using hash "output" method&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 11:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860126#M339810</guid>
      <dc:creator>mariopellegrini</dc:creator>
      <dc:date>2023-02-22T11:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: add column for output method Hash Object</title>
      <link>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860129#M339813</link>
      <description>&lt;P&gt;Loading and then writing a hash table is still a read/write operation so for your use case wouldn't offer any advantage over a simple data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the hash object offers often real advantages for lookups as it helps to avoid sorts.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 11:43:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/add-column-for-output-method-Hash-Object/m-p/860129#M339813</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-22T11:43:43Z</dc:date>
    </item>
  </channel>
</rss>

