<?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: Hash Object with Wildcards in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/297105#M62358</link>
    <description>Sorry, I meant the code above ... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;However you replied to my question so thank you very much!</description>
    <pubDate>Thu, 08 Sep 2016 05:12:19 GMT</pubDate>
    <dc:creator>_SAS_</dc:creator>
    <dc:date>2016-09-08T05:12:19Z</dc:date>
    <item>
      <title>Hash Object with Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/296594#M62174</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables - the first contains products with different attributes and prices. The second table is a mapping of these products based on the attributes they have to different reporting positions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is use a hash object on the mapping table to assign each product to the reportin categories. Would it be possible to use such a hash table if not all products are using the same key - meaning using some kind of wildcards in the mapping table for the attributes the check should skip?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, in the code below, the mapping is done on the product name and color. This works fine for pencils but i want the ballpens to be reported in category 2.1 no matter the color. Would this be possible with only one hash object and one mapping&amp;nbsp;table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Products;
	length 
		product $10
		color $10
		price 8
	;
	input product $ color $ price;

datalines;
Pencil Blue 10
Pencil Red 15
BallPoint Blue 20
BallPoint Red 25
run;

data Mapping;
	length 
		product $10
		color $10
		report_position $10
	;
	input product $ color $ report_position $;

datalines;
Pencil Blue 1.1.1
Pencil Red 1.1.2
BallPoint * 2.1
run;

data report;
	set Products;
	length 
		report_position $10
	;

	if _N_=1 then do;
		declare hash h(dataset:"Mapping");
		h.definekey("product","color");
		h.definedata("report_position");
		h.definedone();
	end;

	rc = h.find();

run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2016 19:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/296594#M62174</guid>
      <dc:creator>_SAS_</dc:creator>
      <dc:date>2016-09-05T19:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Object with Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/296600#M62180</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the find method does not find an entry, you could find again this time, setting the color to search for to "*", see code sample below.&lt;/P&gt;
&lt;P&gt;The hash object always needs all the keys to be present.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data report;
  set Products;
  length 
    report_position $10
  ;

  if _N_=1 then do;
    declare hash h(dataset:"Mapping");
    h.definekey("product","color");
    h.definedata("report_position");
    h.definedone();
  end;

  rc = h.find();
  if rc ne 0 then do;
    rc = h.find(key: product, key: "*");
  end;
  putlog _all_;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2016 20:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/296600#M62180</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-09-05T20:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Object with Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/296632#M62197</link>
      <description>&lt;P&gt;Thanks a lot for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One additional question - maybe also stupid - is there a way to specify for the key a NOT value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, for the code below, is it possible specifiy a mapping&amp;nbsp;for the pencils which are NOT blue? If not via the hash object, maybe you have some other sugestions how to do this in an optimal way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2016 05:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/296632#M62197</guid>
      <dc:creator>_SAS_</dc:creator>
      <dc:date>2016-09-06T05:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Object with Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/296638#M62200</link>
      <description>They key has to be a match. You mentioned "for the code below", but there is no code.</description>
      <pubDate>Tue, 06 Sep 2016 06:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/296638#M62200</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-09-06T06:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Hash Object with Wildcards</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/297105#M62358</link>
      <description>Sorry, I meant the code above ... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;However you replied to my question so thank you very much!</description>
      <pubDate>Thu, 08 Sep 2016 05:12:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hash-Object-with-Wildcards/m-p/297105#M62358</guid>
      <dc:creator>_SAS_</dc:creator>
      <dc:date>2016-09-08T05:12:19Z</dc:date>
    </item>
  </channel>
</rss>

