<?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: Adding a Calculated Field When Joining Two Tables via a Hash Table in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649638#M36085</link>
    <description>&lt;P&gt;Thanks, you couldn't just add a quick example for me, I'm not sure I really have the syntax for this straight in my head!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
    <pubDate>Thu, 21 May 2020 16:58:44 GMT</pubDate>
    <dc:creator>paulrockliffe</dc:creator>
    <dc:date>2020-05-21T16:58:44Z</dc:date>
    <item>
      <title>Adding a Calculated Field When Joining Two Tables via a Hash Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649623#M36083</link>
      <description>&lt;P&gt;I have the programme below that I use in Enterprise Guide to subset a massive table.&amp;nbsp; I want to add some calculated fields at the same time, to allow me to subset the table further for various conditions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data WORK.EXAMPLE (keep = Var1 Var2 Var3 Var4 Var5) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if 0 then set WORK.HASH WORK.SOURCE;&lt;/P&gt;&lt;P&gt;if _n_ = 1 then do;&lt;/P&gt;&lt;P&gt;declare hash l (dataset:"WORK.HASH");&lt;BR /&gt;l.definekey("Var2");&lt;BR /&gt;l.definedata("Var2r", "Var1", "Var3");&lt;BR /&gt;l.definedone();&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;set WORK.SOURCE ;&lt;/P&gt;&lt;P&gt;if l.find() = 0&lt;/P&gt;&lt;P&gt;Output;&lt;/P&gt;&lt;P&gt;Run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can do it quite easily with Query Builder, but I'm trying to avoid creating a second copy of the data on my server - The initial subset creates a 14Gb file, so it's not one to duplicate!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 16:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649623#M36083</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-05-21T16:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Calculated Field When Joining Two Tables via a Hash Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649625#M36084</link>
      <description>&lt;P&gt;Use the find method in a subsetting if:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if l.find() = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then add your calculations after this; if you need any further subsetting, use further subsetting IFs.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 16:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649625#M36084</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-21T16:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Calculated Field When Joining Two Tables via a Hash Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649638#M36085</link>
      <description>&lt;P&gt;Thanks, you couldn't just add a quick example for me, I'm not sure I really have the syntax for this straight in my head!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 16:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649638#M36085</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-05-21T16:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Calculated Field When Joining Two Tables via a Hash Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649657#M36086</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;set WORK.SOURCE ;
if l.find() = 0;
/* add aditional code here */
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since I don't know what exactly you want to do, I can't write code for it.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 17:31:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649657#M36086</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-21T17:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Calculated Field When Joining Two Tables via a Hash Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649671#M36087</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp; I'm creating a key by concatenating two of my variables and a flag that is 1 if one of the variables is over 100.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add those as new variables rather than subsetting directly as I'm running a few different operations from the resulting dataset.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 18:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649671#M36087</guid>
      <dc:creator>paulrockliffe</dc:creator>
      <dc:date>2020-05-21T18:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Calculated Field When Joining Two Tables via a Hash Table</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649681#M36090</link>
      <description>&lt;P&gt;So you do just a few simple assignments, and one of those conditionally (if-then). Nothing fancy, just insert the code where I put the comment.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 19:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Adding-a-Calculated-Field-When-Joining-Two-Tables-via-a-Hash/m-p/649681#M36090</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-21T19:27:25Z</dc:date>
    </item>
  </channel>
</rss>

