<?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 to do a lookup and replace values from one dataset to another? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36800#M7232</link>
    <description>You have some options depending on preference mostly:&lt;BR /&gt;
&lt;BR /&gt;
1) DATA step: MERGE on common-sorted files.&lt;BR /&gt;
2) PROC SQL: JOIN to combine tables on comon variable list.&lt;BR /&gt;
3) PROC FORMAT and DATA step using a PUT function to perform the look-up.&lt;BR /&gt;
&lt;BR /&gt;
Recommend some DOC review on the above, and likely, check the SAS Support website at &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; for SAS coding samples and examples in SAS SUGI/SGF technical conference papers.  &lt;BR /&gt;
&lt;BR /&gt;
Another option is a &lt;A href="http://Google.com/" target="_blank"&gt;http://Google.com/&lt;/A&gt;  advanced such as:&lt;BR /&gt;
&lt;BR /&gt;
+lookup +example site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Wed, 06 Aug 2008 23:11:44 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2008-08-06T23:11:44Z</dc:date>
    <item>
      <title>How to do a lookup and replace values from one dataset to another?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36799#M7231</link>
      <description>Hi All&lt;BR /&gt;
&lt;BR /&gt;
I am trying to do a "lookup" if you like into one dataset and replace the matching values in another dataset.  EG&lt;BR /&gt;
&lt;BR /&gt;
Dataset A has the following values&lt;BR /&gt;
&lt;BR /&gt;
0100    23001&lt;BR /&gt;
0101    23002&lt;BR /&gt;
&lt;BR /&gt;
And dataset B has the following values&lt;BR /&gt;
&lt;BR /&gt;
0100&lt;BR /&gt;
0101&lt;BR /&gt;
&lt;BR /&gt;
What i want to do is look into dataset A and grab the corresponding values - so in this case I want to replace 0100 with 23001 in Dataset B and likewise, 0101 will be replaced to 23002 by looking into Dataset A for the value.&lt;BR /&gt;
&lt;BR /&gt;
I am on version 9 and on the mainframe.&lt;BR /&gt;
&lt;BR /&gt;
Any help will be greatly appreaciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Wed, 06 Aug 2008 22:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36799#M7231</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-08-06T22:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a lookup and replace values from one dataset to another?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36800#M7232</link>
      <description>You have some options depending on preference mostly:&lt;BR /&gt;
&lt;BR /&gt;
1) DATA step: MERGE on common-sorted files.&lt;BR /&gt;
2) PROC SQL: JOIN to combine tables on comon variable list.&lt;BR /&gt;
3) PROC FORMAT and DATA step using a PUT function to perform the look-up.&lt;BR /&gt;
&lt;BR /&gt;
Recommend some DOC review on the above, and likely, check the SAS Support website at &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; for SAS coding samples and examples in SAS SUGI/SGF technical conference papers.  &lt;BR /&gt;
&lt;BR /&gt;
Another option is a &lt;A href="http://Google.com/" target="_blank"&gt;http://Google.com/&lt;/A&gt;  advanced such as:&lt;BR /&gt;
&lt;BR /&gt;
+lookup +example site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 06 Aug 2008 23:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36800#M7232</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-08-06T23:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a lookup and replace values from one dataset to another?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36801#M7233</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
Thanks for replying&lt;BR /&gt;
&lt;BR /&gt;
I resolved this issue by using firstly a join (PROC SQL) on the two datasets.  I had to do this twice because I wanted to update two columns in the dataset to be updated.  Then i did a MERGE on the two VIEWS I created (via proc sql) - the merge was on a key field (serial number).&lt;BR /&gt;
&lt;BR /&gt;
Cheers&lt;BR /&gt;
Shelton.</description>
      <pubDate>Thu, 07 Aug 2008 03:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36801#M7233</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-08-07T03:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a lookup and replace values from one dataset to another?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36802#M7234</link>
      <description>Using the update statement in the data step in another option.  The update is great b/c it only replaces non-missing values.</description>
      <pubDate>Thu, 07 Aug 2008 12:01:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-do-a-lookup-and-replace-values-from-one-dataset-to/m-p/36802#M7234</guid>
      <dc:creator>darrylovia</dc:creator>
      <dc:date>2008-08-07T12:01:57Z</dc:date>
    </item>
  </channel>
</rss>

