<?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: Use Lookup table in SAS to replace values in original table in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713134#M27119</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/361602"&gt;@SAS_New_User1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No rule, just a simple table. The first column is the unique identifier.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hard to believe there is no rule involved at all. Otherwise the result you show is just of about 24 possible outcomes. So why is the result you show the one that is wanted? That is the rule (s) needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Variable names? So we can talk about how to use any specific values.&lt;/P&gt;
&lt;P&gt;Variable types? If a value in one data set is numeric and character in the other then additional steps will be needed.&lt;/P&gt;</description>
    <pubDate>Thu, 21 Jan 2021 17:02:20 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-01-21T17:02:20Z</dc:date>
    <item>
      <title>Use Lookup table in SAS to replace values in original table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713123#M27116</link>
      <description>&lt;P&gt;I have 2 datasets&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset country&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;USA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Blue &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;32&lt;/P&gt;&lt;P&gt;2 &amp;nbsp;UK. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Red &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 15&lt;/P&gt;&lt;P&gt;3 &amp;nbsp;Australia &amp;nbsp; &amp;nbsp; &amp;nbsp; Green &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;52&lt;/P&gt;&lt;P&gt;5 &amp;nbsp;Africa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Yellow &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;44&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset animal&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; &amp;nbsp; 15 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Deer&lt;/P&gt;&lt;P&gt;2 &amp;nbsp; &amp;nbsp;&amp;nbsp;52 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Kangaroo&lt;/P&gt;&lt;P&gt;3 &amp;nbsp; &amp;nbsp; 44 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Lion&lt;/P&gt;&lt;P&gt;4 &amp;nbsp; &amp;nbsp;&amp;nbsp;32 &amp;nbsp; &amp;nbsp; &amp;nbsp; Bison&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I use this lookup table to get the below output in the country dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset country&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;USA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Blue &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Bison&lt;/P&gt;&lt;P&gt;2 &amp;nbsp;UK. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Red &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Deer&lt;/P&gt;&lt;P&gt;3 &amp;nbsp;Australia &amp;nbsp; &amp;nbsp; &amp;nbsp; Green &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Kangaroo&lt;/P&gt;&lt;P&gt;5 &amp;nbsp;Africa &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Yellow &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Lion&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 16:38:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713123#M27116</guid>
      <dc:creator>SAS_New_User1</dc:creator>
      <dc:date>2021-01-21T16:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use Lookup table in SAS to replace values in original table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713126#M27117</link>
      <description>&lt;P&gt;Do have an actual RULE for how these get combined.&lt;/P&gt;
&lt;P&gt;What is that first column of numbers you show?&lt;/P&gt;
&lt;P&gt;What are the names of the variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This might be a simple Data step merge or Proc SQL join on the variable that is showing values 15, 32, 52 and 44.&lt;/P&gt;
&lt;P&gt;Maybe. Depends on if there are duplicates of the values and what that might do to the result.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 16:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713126#M27117</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-21T16:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use Lookup table in SAS to replace values in original table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713127#M27118</link>
      <description>No rule, just a simple table. The first column is the unique identifier.</description>
      <pubDate>Thu, 21 Jan 2021 16:48:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713127#M27118</guid>
      <dc:creator>SAS_New_User1</dc:creator>
      <dc:date>2021-01-21T16:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Use Lookup table in SAS to replace values in original table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713134#M27119</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/361602"&gt;@SAS_New_User1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No rule, just a simple table. The first column is the unique identifier.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hard to believe there is no rule involved at all. Otherwise the result you show is just of about 24 possible outcomes. So why is the result you show the one that is wanted? That is the rule (s) needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Variable names? So we can talk about how to use any specific values.&lt;/P&gt;
&lt;P&gt;Variable types? If a value in one data set is numeric and character in the other then additional steps will be needed.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 17:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713134#M27119</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-21T17:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: Use Lookup table in SAS to replace values in original table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713139#M27120</link>
      <description>&lt;P&gt;Your rule is merge by unique identifier.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=t1; by ID;
proc sort data=t2; by ID;
data want;
merge t1 t2 (keep = ID colour);
by ID;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/361602"&gt;@SAS_New_User1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No rule, just a simple table. The first column is the unique identifier.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 17:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713139#M27120</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-21T17:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Use Lookup table in SAS to replace values in original table</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713141#M27121</link>
      <description>&lt;P&gt;So you want to change 32 into Bison?&amp;nbsp; Looks like you just want to make a format and not actually change the original dataset at all.&amp;nbsp; Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data country ;
  input id name :$20. color :$10. code ;
cards;
1  USA               Blue          32
2  UK.               Red           15
3  Australia       Green        52
5  Africa            Yellow        44
;

data animal ;
  input id code animal $20. ;
cards;
1     15        Deer
2     52        Kangaroo
3     44        Lion
4     32       Bison
;

data fmt ;
set animal ;
fmtname='ANIMAL';
rename code=start animal=label;
run;

proc format cntlin=fmt ;
run;

proc print data=country;
  format code animal. ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;Obs    id    name         color     code

 1      1    USA          Blue      Bison
 2      2    UK.          Red       Deer
 3      3    Australia    Green     Kangaroo
 4      5    Africa       Yellow    Lion
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 17:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Use-Lookup-table-in-SAS-to-replace-values-in-original-table/m-p/713141#M27121</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-21T17:27:22Z</dc:date>
    </item>
  </channel>
</rss>

