<?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: Sales and Payment Data Merging in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821277#M40994</link>
    <description>&lt;P&gt;Simple debugging of your code (which you should do yourself from now on): I modify your PROC SQL so we can see what the merge is doing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table final as
    select b.orderdate,
        b.promo_type,
        b.payment_type,
        b.payment_amt,
        a.sales_amt
    from sales a
    left join payment b on a.orderdate=b.orderdate ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This produces the following table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1656677070035.png"&gt;&lt;img src="https://communities.sas.com/skins/images/70F8802BAA6255D55FBEC62A8226FB10/responsive_peak/images/image_not_found.png" alt="PaigeMiller_0-1656677070035.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So when Payment_type is cash, there are two records and the sum of the sales amount would then be doubled&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which brings up the question ... why do you want to do this merge in the first place? Why don't you compute total sales from the sales data and total payments from the payment data?&lt;/P&gt;</description>
    <pubDate>Fri, 01 Jul 2022 13:20:34 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-07-01T13:20:34Z</dc:date>
    <item>
      <title>Sales and Payment Data Merging</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821267#M40991</link>
      <description>&lt;P&gt;Hello Experts.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to join/merge sales and payment data. But, my summarization data is giving me duplicate sales amount. I dont want that&lt;/P&gt;
&lt;P&gt;Datasets are below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data payment;&lt;BR /&gt;infile cards dlm=',' dsd;&lt;BR /&gt;input ticketid :$20. Promo_Type Payment_Type :$12. &lt;BR /&gt;customer_id :$15. OrderDate :yymmdd10. Promo_Des :$30. Payment_Amt;&lt;BR /&gt;format OrderDate yymmdd10.;&lt;BR /&gt;cards;&lt;BR /&gt;A098765,,credit,C014532,2021-05-11,,500&lt;BR /&gt;A098765,,cash,C014532,2021-05-11,,100&lt;BR /&gt;A098765,,cash,C014532,2021-05-11,,180&lt;BR /&gt;A098765,,check,C014532,2021-05-11,,200&lt;BR /&gt;A098765,8360,Finance,C014532,2021-05-11,"36 months",5000&lt;BR /&gt;A098765,8600,Finance,C014532,2021-05-11,"60 months",3500&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data Sales;&lt;BR /&gt;infile cards dlm=',' dsd;&lt;BR /&gt;input ticketid :$20. ProductId :$20. customer_id :$15. OrderDate :yymmdd10. Sales_amt;&lt;BR /&gt;format OrderDate yymmdd10.;&lt;BR /&gt;cards;&lt;BR /&gt;A098765,"AX-14589",C014532,2021-05-11,1570&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want my output like this&lt;/P&gt;
&lt;P&gt;Assume Two filters are there.&lt;/P&gt;
&lt;P&gt;1.Payment_Type&lt;/P&gt;
&lt;P&gt;2.Promo_Type&lt;/P&gt;
&lt;TABLE width="405px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="91.8667px"&gt;Orderdate&lt;/TD&gt;
&lt;TD width="139.6px"&gt;sum of sales_amt&lt;/TD&gt;
&lt;TD width="172.733px"&gt;sum of payment_amt&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="91.8667px"&gt;11-05-2021&lt;/TD&gt;
&lt;TD width="139.6px"&gt;1570&lt;/TD&gt;
&lt;TD width="172.733px"&gt;9480&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If i select select Payment_type as Cash means my output need to be&lt;/P&gt;
&lt;TABLE width="410px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="91.65px"&gt;Orderdate&lt;/TD&gt;
&lt;TD width="152.267px"&gt;sum of sales_amt&lt;/TD&gt;
&lt;TD width="165.283px"&gt;sum of payment_amt&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="91.65px"&gt;11-05-2021&lt;/TD&gt;
&lt;TD width="152.267px"&gt;0&lt;/TD&gt;
&lt;TD width="165.283px"&gt;280&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If i select Promo_Type as 8360 means my output need to be&lt;/P&gt;
&lt;TABLE width="427px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="91.85px"&gt;Orderdate&lt;/TD&gt;
&lt;TD width="145.583px"&gt;sum of sales_amt&lt;/TD&gt;
&lt;TD width="188.767px"&gt;sum of payment_amt&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="91.85px"&gt;11-05-2021&lt;/TD&gt;
&lt;TD width="145.583px"&gt;0&lt;/TD&gt;
&lt;TD width="188.767px"&gt;5000&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can some one help me on this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 10:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821267#M40991</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2022-07-01T10:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sales and Payment Data Merging</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821271#M40992</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/366820"&gt;@_el_doredo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to join/merge sales and payment data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Join/merge on what variables? You don't tell us, but we would need to know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;But, my summarization data is giving me duplicate sales amount. I dont want that&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us your code.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 11:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821271#M40992</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-01T11:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sales and Payment Data Merging</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821275#M40993</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc sql;&lt;BR /&gt;create table final as&lt;BR /&gt;select b.orderdate,&lt;BR /&gt;b.promo_type,&lt;BR /&gt;b.payment_type,&lt;BR /&gt;sum(b.Payment_Amt) as Payment_amt,&lt;BR /&gt;sum(a.Sales_Amt) as Sales_amt&lt;BR /&gt;from sales a&lt;BR /&gt;left join payment b&lt;BR /&gt;on a.orderdate=b.orderdate&lt;BR /&gt;group by 1,2,3&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 11:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821275#M40993</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2022-07-01T11:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sales and Payment Data Merging</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821277#M40994</link>
      <description>&lt;P&gt;Simple debugging of your code (which you should do yourself from now on): I modify your PROC SQL so we can see what the merge is doing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table final as
    select b.orderdate,
        b.promo_type,
        b.payment_type,
        b.payment_amt,
        a.sales_amt
    from sales a
    left join payment b on a.orderdate=b.orderdate ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This produces the following table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1656677070035.png"&gt;&lt;img src="https://communities.sas.com/skins/images/70F8802BAA6255D55FBEC62A8226FB10/responsive_peak/images/image_not_found.png" alt="PaigeMiller_0-1656677070035.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So when Payment_type is cash, there are two records and the sum of the sales amount would then be doubled&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which brings up the question ... why do you want to do this merge in the first place? Why don't you compute total sales from the sales data and total payments from the payment data?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 13:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/821277#M40994</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-01T13:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sales and Payment Data Merging</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/823473#M41081</link>
      <description>Sorry for the last response. Actually requirement is not right in this case..&lt;BR /&gt;&lt;BR /&gt;Thanks for your help</description>
      <pubDate>Fri, 15 Jul 2022 08:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Sales-and-Payment-Data-Merging/m-p/823473#M41081</guid>
      <dc:creator>_el_doredo</dc:creator>
      <dc:date>2022-07-15T08:16:46Z</dc:date>
    </item>
  </channel>
</rss>

