<?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: Lookup Values from another table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260589#M310096</link>
    <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are more steps to follow after this process. Given the SAS data model, I agree the long form is more amenable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Apr 2016 01:14:26 GMT</pubDate>
    <dc:creator>sai_ch</dc:creator>
    <dc:date>2016-04-01T01:14:26Z</dc:date>
    <item>
      <title>Lookup Values from another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260548#M310092</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me figure out a better way to look up values. Below are the tables and the desired table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 1:&lt;/P&gt;&lt;P&gt;_Name_&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Var3&amp;nbsp;&amp;nbsp;&amp;nbsp; Var4&lt;/P&gt;&lt;P&gt;DS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 200&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;300&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 400&lt;/P&gt;&lt;P&gt;Grade&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;Grade&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;value&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.1&lt;/P&gt;&lt;P&gt;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.2&lt;/P&gt;&lt;P&gt;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.3&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table Want:&lt;/P&gt;&lt;P&gt;_Name_&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Var3&amp;nbsp;&amp;nbsp;&amp;nbsp; Var4&lt;/P&gt;&lt;P&gt;DS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 200&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;300&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 400&lt;/P&gt;&lt;P&gt;Grade&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;&lt;P&gt;Value&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0.3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have working solution by tranposing Table1 and then merging with Table2 and then transposing back the merged table. I am trying to reduce processing time as&amp;nbsp;the datasets are big and the process is repeated multiple times. Any help is greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 20:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260548#M310092</guid>
      <dc:creator>sai_ch</dc:creator>
      <dc:date>2016-03-31T20:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Values from another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260552#M310093</link>
      <description>&lt;P&gt;It looks like you are trying to create a row of look-ed up values based on a row of lookup values. I'd say in that case your approach of transposing, performing the lookup and reverse transposing is a good approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where it rubs it is because the data model is rather awkward and not well suited for analysis and reporting or basically anything. I'd go for the transposed model of table 1 and use that as the basis for subsequent processing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Id DS Grade&lt;/P&gt;
&lt;P&gt;1 100 3&lt;/P&gt;
&lt;P&gt;2 200 4&lt;/P&gt;
&lt;P&gt;3 300 5&lt;/P&gt;
&lt;P&gt;4 400 6&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 20:58:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260552#M310093</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-03-31T20:58:37Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Values from another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260562#M310094</link>
      <description>&lt;P&gt;Which is often why a long data structure is optimal over a wide data structure. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given your exact case it isn't hard to find workarounds, but if you say your data set is large I have a feeling there are other issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this exactly what you would do with your actual data, or are there other steps required as well. I have a strong suspicion that may change the answer.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 21:28:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260562#M310094</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-31T21:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Values from another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260563#M310095</link>
      <description>&lt;P&gt;Why not just transpose table 2 instead?&amp;nbsp; The results will be ready to combine with Table 1 in a DATA step.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 21:30:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260563#M310095</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-31T21:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Values from another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260589#M310096</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are more steps to follow after this process. Given the SAS data model, I agree the long form is more amenable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 01:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260589#M310096</guid>
      <dc:creator>sai_ch</dc:creator>
      <dc:date>2016-04-01T01:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Values from another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260592#M310097</link>
      <description>&lt;PRE&gt;

If you didn't have a big table. Try double proc transpose .



data Table1;
input _Name_   $  Var1      Var2    Var3    Var4;
cards;
DS             100         200     300      400
Grade          3             4         5           6
;
run;
 
data Table2;
input Grade    value;
cards;
  3            0.1
  4            0.2
  5            0.3 
  6            0.4
;
run;
proc transpose data=table1 out=temp;
var var:;
id _name_;
run;
data temp1;
 merge table2 temp;
 by Grade    ;
run;
proc transpose data=temp1 out=want;
id _name_;
run;




&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Apr 2016 01:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260592#M310097</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-01T01:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup Values from another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260695#M310098</link>
      <description>&lt;P&gt;Depending on how big table 2 is, you could also attach this with PROC FORMAT.&amp;nbsp; Depending on your final needs, you may not even need to store the third row in your final data set.&amp;nbsp; Try this Google search for a number of examples:&lt;/P&gt;&lt;P&gt;proc format data lookup site:sas.com&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 13:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-Values-from-another-table/m-p/260695#M310098</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2016-04-01T13:19:31Z</dc:date>
    </item>
  </channel>
</rss>

