<?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: Trying to create a table that shows totals for each row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806620#M317842</link>
    <description>&lt;P&gt;Are you trying to play practical jokes with us, or are yoz'u just too lazy (or too incompetent) to learn the utter basics of SAS?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/406226"&gt;@dexcort2020&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;LI-CODE lang="sas"&gt; summary data=have nway;
    member plancategory;
    var memberct cost;
    output =num sum=memberct totalcost;
run;&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Apr 2022 19:04:54 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-04-07T19:04:54Z</dc:date>
    <item>
      <title>Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806401#M317702</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I need the table to look like this:&lt;/P&gt;
&lt;P&gt;plan category&amp;nbsp; &amp;nbsp;memberct&amp;nbsp; &amp;nbsp; total cost&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table claims&lt;BR /&gt;as select &lt;BR /&gt;memberNo,&lt;BR /&gt;planPayer,&lt;BR /&gt;claimHeaderId,&lt;BR /&gt;cpt,&lt;BR /&gt;cptdescription,&lt;BR /&gt;cost,&lt;BR /&gt;eventDate,&lt;BR /&gt;trim(memberNo)||trim(eventDate) as visitct,&lt;BR /&gt;providerNPI,&lt;BR /&gt;providerName,&lt;BR /&gt;providerSpecialty&lt;BR /&gt;from x.eventLineDetails&lt;BR /&gt;where providerSpecialty In ('Cardiology', "Cardiovascular Disease")&lt;BR /&gt;and eventDate between "2021-01-01" and "2021-12-31"&lt;BR /&gt;and claimatRisk=1&lt;BR /&gt;and cpt in &amp;amp;EMCODES;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*put into 3 buckets*/&lt;BR /&gt;data claims2;&lt;BR /&gt;set claims;&lt;BR /&gt;if planPayer="ddd" then planCategory="ddd2"; &lt;BR /&gt;else if planPayer="ggg" then planCategory="ggg2"; &lt;BR /&gt;else planCategory="ooo";&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 21:31:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806401#M317702</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2022-04-06T21:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806403#M317704</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@anonymous_user&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I need the table to look like this:&lt;/P&gt;
&lt;P&gt;plan category&amp;nbsp; &amp;nbsp;memberct&amp;nbsp; &amp;nbsp; total cost&amp;nbsp; &lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Show us more of this table, with fake numbers if necessary, so we can grasp what you want to do. Also you want total cost in this table, where does that come from. I think we need a lot more detail and clarity in your explanation.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 21:20:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806403#M317704</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-06T21:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806405#M317706</link>
      <description>plancategory     memberCt     totalcost&lt;BR /&gt; &lt;BR /&gt;ddd2            20,0000         1,000,000&lt;BR /&gt;ggg2               1,500            500,000&lt;BR /&gt;ooo               11,200            250,000</description>
      <pubDate>Wed, 06 Apr 2022 21:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806405#M317706</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2022-04-06T21:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806406#M317707</link>
      <description>&lt;P&gt;Ok, if I am understanding everything properly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have nway;
    class plancategory;
    var memberct cost;
    output out=want sum=memberct totalcost;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 21:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806406#M317707</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-06T21:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806433#M317723</link>
      <description>thank you but when i do this it brings back the correct counts under the freq column instead of the memberct column.  Should I count the memberNo in the first proc sql step or in the other data step where I define the buckets?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Apr 2022 04:16:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806433#M317723</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2022-04-07T04:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806437#M317726</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=claims2 nway;
class plancategory;
var cost;
output
  out=want (drop=_type_ rename=(_freq_=membercnt))
  sum(cost)=totalcost
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 06:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806437#M317726</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-07T06:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806438#M317727</link>
      <description>&lt;P&gt;You can integrate the creation of plancategory in the SQL:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table claims as
  select 
    memberNo,
    planPayer,
    claimHeaderId,
    cpt,
    cptdescription,
    cost,
    eventDate,
    trim(memberNo)||trim(eventDate) as visitct,
    providerNPI,
    providerName,
    providerSpecialty,
    case
      when planPayer = "ddd" then "ddd2"
      when planPayer = "ggg" then "ggg2"
      else "ooo"
    end as planCategory
  from x.eventLineDetails
  where
    providerSpecialty In ('Cardiology', "Cardiovascular Disease")
    and eventDate between "2021-01-01" and "2021-12-31"
    and claimatRisk=1
    and cpt in &amp;amp;EMCODES
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also take note how indentation is used to make the code readable.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 06:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806438#M317727</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-07T06:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806516#M317774</link>
      <description>&lt;LI-CODE lang="sas"&gt;data summary data=have nway;
    output plancategory;
    memory memberct cost;
    mem=want sum=memberct totalcost;
run;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 14:04:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806516#M317774</guid>
      <dc:creator>dexcort2020</dc:creator>
      <dc:date>2022-04-07T14:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806545#M317794</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/406226"&gt;@dexcort2020&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;LI-CODE lang="sas"&gt;data summary data=have nway;
    output plancategory;
    memory memberct cost;
    mem=want sum=memberct totalcost;
run;&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;PRE&gt; 69         data summary data=have nway;
                             _
                             22
                             200
 70             output plancategory;
                       ____________
                       455
 71             memory memberct cost;
                ______
                180
 ERROR 22-322: Syntaxfehler, erwartet wird eines der folgenden: ein Name, eine Zeichenkette in Hochkommata, (, /, ;, _DATA_, _LAST_, 
               _NULL_.  
 
 ERROR 200-322: The symbol is not recognized and will be ignored.
 
 ERROR 455-185: Data set was not specified on the DATA statement.
 
 ERROR 180-322: Statement is not valid or it is used out of proper order.
 
 72             mem=want sum=memberct totalcost;
                         ___
                         22
 ERROR 22-322: Syntaxfehler, erwartet wird eines der folgenden: !, !!, &amp;amp;, (, *, **, +, -, /, ;, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, 
               GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, [, ^=, {, |, ||, ~=.  
 
 72       !     mem=want sum=memberct totalcost;
                                      _________
                                      22
 ERROR 22-322: Syntaxfehler, erwartet wird eines der folgenden: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;&amp;lt;, &amp;gt;=, AND, EQ, GE, GT, 
               IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||, ~=.  
 
 73         run;
 
 NOTE: The SAS System stopped processing this step because of errors.
&lt;/PRE&gt;
&lt;P&gt;If you are here to learn the most simple basics of SAS, I recommend to work through the free online Programming 1 course first.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 15:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806545#M317794</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-07T15:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806570#M317816</link>
      <description>&lt;LI-CODE lang="sas"&gt; summary data=have nway;
    member plancategory;
    var memberct cost;
    output =num sum=memberct totalcost;
run;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Apr 2022 16:44:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806570#M317816</guid>
      <dc:creator>dexcort2020</dc:creator>
      <dc:date>2022-04-07T16:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806577#M317822</link>
      <description>THANK YOU!</description>
      <pubDate>Thu, 07 Apr 2022 17:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806577#M317822</guid>
      <dc:creator>anonymous_user</dc:creator>
      <dc:date>2022-04-07T17:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a table that shows totals for each row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806620#M317842</link>
      <description>&lt;P&gt;Are you trying to play practical jokes with us, or are yoz'u just too lazy (or too incompetent) to learn the utter basics of SAS?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/406226"&gt;@dexcort2020&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;LI-CODE lang="sas"&gt; summary data=have nway;
    member plancategory;
    var memberct cost;
    output =num sum=memberct totalcost;
run;&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 19:04:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-create-a-table-that-shows-totals-for-each-row/m-p/806620#M317842</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-04-07T19:04:54Z</dc:date>
    </item>
  </channel>
</rss>

