<?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 apply customer information in one set to a set of transactions in another using Key ID in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-customer-information-in-one-set-to-a-set-of/m-p/591187#M169322</link>
    <description>&lt;P&gt;You did not provide any thing to tell the Merge to use the ID value. Which would be a BY ID statement if both sets are sorted by Id.&lt;/P&gt;
&lt;P&gt;However Merge may run into issues with many-to-one (multiple transactions for one customer) and the order you place the data sets on a merge statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc SQL has many tools for combining data in interesting ways. One way:&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table joined as
   select a.*, b.city, b.state
   from cd8940.transactiondata as a
        left join
        cd8940.customer_info as b
        on a.id = b.id
   ;
quit;&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 Sep 2019 15:21:24 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-09-24T15:21:24Z</dc:date>
    <item>
      <title>How to apply customer information in one set to a set of transactions in another using Key ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-customer-information-in-one-set-to-a-set-of/m-p/591185#M169321</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 2 sets of data in SAS Studio. The 1st data set has basic customer information (customer ID, city, state, etc...) and the 2nd data set has a listing of transaction by each customer. I need to append the customer data to the transaction data using the customer ID. I've tried using the merge function, but it then narrows down the transaction information down to 1 observation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data transactions;
      set CD8940.transaction_data;
run;

data customer_info;
     set CD8940.customer_info;
run;

data merged;
	merge transactions customer_info;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help is greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 15:07:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-apply-customer-information-in-one-set-to-a-set-of/m-p/591185#M169321</guid>
      <dc:creator>smcconn5</dc:creator>
      <dc:date>2019-09-24T15:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply customer information in one set to a set of transactions in another using Key ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-customer-information-in-one-set-to-a-set-of/m-p/591187#M169322</link>
      <description>&lt;P&gt;You did not provide any thing to tell the Merge to use the ID value. Which would be a BY ID statement if both sets are sorted by Id.&lt;/P&gt;
&lt;P&gt;However Merge may run into issues with many-to-one (multiple transactions for one customer) and the order you place the data sets on a merge statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc SQL has many tools for combining data in interesting ways. One way:&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table joined as
   select a.*, b.city, b.state
   from cd8940.transactiondata as a
        left join
        cd8940.customer_info as b
        on a.id = b.id
   ;
quit;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Sep 2019 15:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-apply-customer-information-in-one-set-to-a-set-of/m-p/591187#M169322</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-24T15:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply customer information in one set to a set of transactions in another using Key ID</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-apply-customer-information-in-one-set-to-a-set-of/m-p/591222#M169333</link>
      <description>&lt;P&gt;Worked like a charm!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 16:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-apply-customer-information-in-one-set-to-a-set-of/m-p/591222#M169333</guid>
      <dc:creator>smcconn5</dc:creator>
      <dc:date>2019-09-24T16:39:13Z</dc:date>
    </item>
  </channel>
</rss>

