<?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 do i combine two tables and do a summary for the totals? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-combine-two-tables-and-do-a-summary-for-the-totals/m-p/650777#M22356</link>
    <description>&lt;P&gt;Here is the code before the transpose:&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table summary as&lt;BR /&gt;select count(distinct key) as vistcnt, state,&lt;BR /&gt;date, codes, sum(disbursmnt) as paymnt&lt;BR /&gt;from meds&lt;BR /&gt;where state in ('NY','PA','NJ')&lt;BR /&gt;group by state, date, codes;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;proc sort data = summary;&lt;BR /&gt;by state codes;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2020 14:35:42 GMT</pubDate>
    <dc:creator>SM8</dc:creator>
    <dc:date>2020-05-26T14:35:42Z</dc:date>
    <item>
      <title>How do i combine two tables and do a summary for the totals?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-combine-two-tables-and-do-a-summary-for-the-totals/m-p/650770#M22354</link>
      <description>&lt;P&gt;So,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two tables that I created using proc sql and then transposed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table summary as&lt;BR /&gt;select count(distinct key) as vistcnt, state,&lt;BR /&gt;date, codes, sum(disbursmnt) as paymnt&lt;BR /&gt;from meds&lt;BR /&gt;where state in ('NY','PA','NJ')&lt;BR /&gt;group by state, date, codes;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc sort data = summary;&lt;BR /&gt;by state codes;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc transpose data = summary out=visits prefix=visitcount;&lt;BR /&gt;var vistcnt; id date; by state codes;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc transpose data = summary out=payments prefix=dollars;&lt;BR /&gt;var paymnt; id date; by state codes;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I put these two together and do a summary for the total of vistcnt and paymnt?&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 14:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-combine-two-tables-and-do-a-summary-for-the-totals/m-p/650770#M22354</guid>
      <dc:creator>SM8</dc:creator>
      <dc:date>2020-05-26T14:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do i combine two tables and do a summary for the totals?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-combine-two-tables-and-do-a-summary-for-the-totals/m-p/650774#M22355</link>
      <description>&lt;P&gt;Summarize before you transpose. Long datasets are always easier for processing than wide ones.&lt;/P&gt;
&lt;P&gt;For detailed help, provide the untransposed dataset in a data step with datalines.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 14:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-combine-two-tables-and-do-a-summary-for-the-totals/m-p/650774#M22355</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-26T14:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do i combine two tables and do a summary for the totals?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-do-i-combine-two-tables-and-do-a-summary-for-the-totals/m-p/650777#M22356</link>
      <description>&lt;P&gt;Here is the code before the transpose:&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table summary as&lt;BR /&gt;select count(distinct key) as vistcnt, state,&lt;BR /&gt;date, codes, sum(disbursmnt) as paymnt&lt;BR /&gt;from meds&lt;BR /&gt;where state in ('NY','PA','NJ')&lt;BR /&gt;group by state, date, codes;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;proc sort data = summary;&lt;BR /&gt;by state codes;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 14:35:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-do-i-combine-two-tables-and-do-a-summary-for-the-totals/m-p/650777#M22356</guid>
      <dc:creator>SM8</dc:creator>
      <dc:date>2020-05-26T14:35:42Z</dc:date>
    </item>
  </channel>
</rss>

