<?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: How do I use a lookup table conditionally? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290649#M60156</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table DESIRED_TABLE as
select 
t1.*
,t2.CityCode as Seller_CityCode
,t2.Language as  Seller_Language
from PRIMARY_DATASET t1 left jon
Lookup_Table t2 
on t1.Seller = t2.City;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Aug 2016 08:02:33 GMT</pubDate>
    <dc:creator>RahulG</dc:creator>
    <dc:date>2016-08-10T08:02:33Z</dc:date>
    <item>
      <title>How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290644#M60153</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've got a primary dataset with variables that I'd like to fill from a lookup table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Primary Dataset&lt;/P&gt;&lt;P&gt;Seller &amp;nbsp;Buyer &amp;nbsp;Product &amp;nbsp;&lt;/P&gt;&lt;P&gt;City1 &amp;nbsp; City2 &amp;nbsp;X&lt;/P&gt;&lt;P&gt;City1 &amp;nbsp; City2 &amp;nbsp;Y&lt;/P&gt;&lt;P&gt;City1 &amp;nbsp; City3 &amp;nbsp;Z&lt;/P&gt;&lt;P&gt;City2 &amp;nbsp; City1 &amp;nbsp;A&lt;/P&gt;&lt;P&gt;City2 &amp;nbsp; City3 &amp;nbsp;A&lt;/P&gt;&lt;P&gt;City3 &amp;nbsp; City1 &amp;nbsp;W&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lookup Table&lt;/P&gt;&lt;P&gt;City &amp;nbsp; CityCode &amp;nbsp; Language &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;City1 &amp;nbsp;CAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EN&lt;/P&gt;&lt;P&gt;City2 &amp;nbsp;BLG &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FR&lt;/P&gt;&lt;P&gt;City3 &amp;nbsp;ELS &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;EN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired Table&lt;/P&gt;&lt;P&gt;Seller &amp;nbsp;Buyer &amp;nbsp;Product &amp;nbsp;Seller_CityCode &amp;nbsp;Seller_Language&lt;/P&gt;&lt;P&gt;City1 &amp;nbsp; City2 &amp;nbsp;X &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EN&lt;/P&gt;&lt;P&gt;City1 &amp;nbsp; City2 &amp;nbsp;Y&lt;SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;City1 &amp;nbsp; City3 &amp;nbsp;Z&lt;SPAN&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CAN &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;City2 &amp;nbsp; City1 &amp;nbsp;A&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;BLG&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;City2 &amp;nbsp; City3 &amp;nbsp;A&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;BLG&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;FR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;City3 &amp;nbsp; City1 &amp;nbsp;W&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ELS&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;EN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any assistance would be most appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SSA&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 07:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290644#M60153</guid>
      <dc:creator>SSA</dc:creator>
      <dc:date>2016-08-10T07:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290646#M60154</link>
      <description>&lt;P&gt;Proc sql left join should solve your problem. &amp;nbsp;Lookup table should be left joined to primary dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing something in your question?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 07:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290646#M60154</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2016-08-10T07:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290647#M60155</link>
      <description>&lt;P&gt;Thanks -- I'm a very new user, and haven't really used proc sql before. &amp;nbsp;Are you able to show me a sample code using the sample data I put on my post?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 07:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290647#M60155</guid>
      <dc:creator>SSA</dc:creator>
      <dc:date>2016-08-10T07:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290649#M60156</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table DESIRED_TABLE as
select 
t1.*
,t2.CityCode as Seller_CityCode
,t2.Language as  Seller_Language
from PRIMARY_DATASET t1 left jon
Lookup_Table t2 
on t1.Seller = t2.City;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Aug 2016 08:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290649#M60156</guid>
      <dc:creator>RahulG</dc:creator>
      <dc:date>2016-08-10T08:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290650#M60157</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sql;
  Create table Desired as
  Select A.*
        ,B.CityCode
        ,B.Language
  From Primary as A
  Left join Lookup as B
  On A.Seller = B.City
  ;
Quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Aug 2016 08:08:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290650#M60157</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-08-10T08:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290651#M60158</link>
      <description>&lt;P&gt;Thanks! &amp;nbsp;I'll try that out.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 08:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290651#M60158</guid>
      <dc:creator>SSA</dc:creator>
      <dc:date>2016-08-10T08:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290653#M60159</link>
      <description>&lt;P&gt;One of the nicest ways to deal with lookups is to create value formats from your lookup tables and use those. No joining or merging necessary.&lt;/P&gt;
&lt;P&gt;The only limitation is that your lookup needs to fit into memory.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 08:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290653#M60159</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-08-10T08:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290658#M60161</link>
      <description>&lt;P&gt;If you don't master programming/SQL queries, try to your hands on SAS Enterprise Guide or SAS Studio web client, where you have tasks (wizards) that guide you through standard operations like joins.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to learn take the free online SAS programming&amp;nbsp;training, and build up your competence&amp;nbsp;from there.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2016 09:11:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290658#M60161</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-08-10T09:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290836#M60232</link>
      <description>Thanks very much, SASKiwi! Worked like a charm.</description>
      <pubDate>Wed, 10 Aug 2016 22:26:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290836#M60232</guid>
      <dc:creator>SSA</dc:creator>
      <dc:date>2016-08-10T22:26:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290837#M60233</link>
      <description>Thanks very much for the speedy assistance, RahulG. I tried this, and it worked very well -- processing time was quick too (I had over 2 million records to process).</description>
      <pubDate>Wed, 10 Aug 2016 22:28:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290837#M60233</guid>
      <dc:creator>SSA</dc:creator>
      <dc:date>2016-08-10T22:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use a lookup table conditionally?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290838#M60234</link>
      <description>I checked this out, and it certainly looks like a good alternative to the proc sql option. Thanks!</description>
      <pubDate>Wed, 10 Aug 2016 22:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-use-a-lookup-table-conditionally/m-p/290838#M60234</guid>
      <dc:creator>SSA</dc:creator>
      <dc:date>2016-08-10T22:30:04Z</dc:date>
    </item>
  </channel>
</rss>

