<?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: Create new variable given information available in multiple datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-new-variable-given-information-available-in-multiple/m-p/270987#M53899</link>
    <description>&lt;P&gt;Hi CF,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This has all the signs of a classic table lookup problem. This class of challenges can be approached in a few ways, a merge (SQL or Datastep) being amongst them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your final choice would be based upon aspects like the size of the base table, the lookup table and their relative sizes. Also your preparedness&amp;nbsp;to recreate the base table is important.&amp;nbsp;Without going to provide detailed code I would suggest, assuming that the base table is both large and much larger than the lookup table, is to used either:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) SQL update&lt;/P&gt;
&lt;P&gt;2) Datastep with MODIFY and a hash table lookup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Keep in mind that every row in your table will have that binary (a datatype that does not exist in SAS; use a flag of type char(1)) variable. Just the value differs. Your question seems to suggest that you are looking for a way of adding the variable only for "Deficit" accounts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps you on your way. There are many many code examples on-line to get you going.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;</description>
    <pubDate>Tue, 17 May 2016 13:50:16 GMT</pubDate>
    <dc:creator>jklaverstijn</dc:creator>
    <dc:date>2016-05-17T13:50:16Z</dc:date>
    <item>
      <title>Create new variable given information available in multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-new-variable-given-information-available-in-multiple/m-p/270981#M53897</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quick question - is there an "easy" or "correct" way to go about with the following procedure:&lt;/P&gt;&lt;P&gt;I have two datasets:&lt;/P&gt;&lt;P&gt;1. dataset 1 is the dataset I principally work with&lt;/P&gt;&lt;P&gt;2. dataset 2 contains information necessary to modify dataset 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both dataset have a ID variable in common (Account #) that is unique to each observation.&lt;/P&gt;&lt;P&gt;I need to perform an IF/THEN/ELSE statement in dataset 1 to a subset of&amp;nbsp;accounts that are identified as "Deficit", which is only available through information provided in dataset 2. Is it possible to create a binary variable in dataset 1 for accounts that are identified as "deficit" in dataset 2?&lt;/P&gt;&lt;P&gt;Would a merge be the only alternative?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2016 13:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-new-variable-given-information-available-in-multiple/m-p/270981#M53897</guid>
      <dc:creator>camfarrell25</dc:creator>
      <dc:date>2016-05-17T13:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create new variable given information available in multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-new-variable-given-information-available-in-multiple/m-p/270987#M53899</link>
      <description>&lt;P&gt;Hi CF,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This has all the signs of a classic table lookup problem. This class of challenges can be approached in a few ways, a merge (SQL or Datastep) being amongst them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your final choice would be based upon aspects like the size of the base table, the lookup table and their relative sizes. Also your preparedness&amp;nbsp;to recreate the base table is important.&amp;nbsp;Without going to provide detailed code I would suggest, assuming that the base table is both large and much larger than the lookup table, is to used either:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) SQL update&lt;/P&gt;
&lt;P&gt;2) Datastep with MODIFY and a hash table lookup.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Keep in mind that every row in your table will have that binary (a datatype that does not exist in SAS; use a flag of type char(1)) variable. Just the value differs. Your question seems to suggest that you are looking for a way of adding the variable only for "Deficit" accounts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps you on your way. There are many many code examples on-line to get you going.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2016 13:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-new-variable-given-information-available-in-multiple/m-p/270987#M53899</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-05-17T13:50:16Z</dc:date>
    </item>
  </channel>
</rss>

