<?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 Proc Summary (Counts and Sums) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/307956#M66011</link>
    <description>&lt;P&gt;Need some help with proc summary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My data is attached with how it currently looks and what I'm hoping it to look like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code I have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;rsubmit;&lt;BR /&gt;proc summary data=worked2 nway;&lt;BR /&gt;var talk_secs acw_secs total_secs total_mins;&lt;BR /&gt;class yr mth dt rep supervisor tactic;&lt;BR /&gt;output out = daily_counts(drop=_type_ rename=(_freq_=tl_count) sum=talk_secs acw_secs total_secs total_mins);&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=daily_counts out=daily_counts;&lt;BR /&gt;by dt;&lt;BR /&gt;proc print data=daily_counts (obs=10);&lt;BR /&gt;run;endrsubmit;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2016 16:56:31 GMT</pubDate>
    <dc:creator>ertweety</dc:creator>
    <dc:date>2016-10-28T16:56:31Z</dc:date>
    <item>
      <title>Proc Summary (Counts and Sums)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/307956#M66011</link>
      <description>&lt;P&gt;Need some help with proc summary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My data is attached with how it currently looks and what I'm hoping it to look like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code I have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;rsubmit;&lt;BR /&gt;proc summary data=worked2 nway;&lt;BR /&gt;var talk_secs acw_secs total_secs total_mins;&lt;BR /&gt;class yr mth dt rep supervisor tactic;&lt;BR /&gt;output out = daily_counts(drop=_type_ rename=(_freq_=tl_count) sum=talk_secs acw_secs total_secs total_mins);&lt;BR /&gt;run;&lt;BR /&gt;proc sort data=daily_counts out=daily_counts;&lt;BR /&gt;by dt;&lt;BR /&gt;proc print data=daily_counts (obs=10);&lt;BR /&gt;run;endrsubmit;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 16:56:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/307956#M66011</guid>
      <dc:creator>ertweety</dc:creator>
      <dc:date>2016-10-28T16:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Summary (Counts and Sums)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/307997#M66015</link>
      <description>&lt;P&gt;If you're not restricted to using PROC SUMMARY, you may find the count() and sum() functions in PROC SQL easier to work with when aggregating data longitudinally. The code below will create the data set you're looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Disclaimer: creating a new line using the sum() and count() function isn't necessary, but was just done for illustrative purposes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create table work.daily_counts as &lt;BR /&gt;&amp;nbsp; select distinct rep, supervisor, year, month, date, tactic&lt;BR /&gt;&amp;nbsp; , count(account_id) as id_count&lt;BR /&gt;&amp;nbsp; , sum(talk_secs) as sum_talk_secs&lt;BR /&gt;&amp;nbsp; , sum(acw_secs) as sum_acw_secs&lt;BR /&gt;&amp;nbsp; , sum(total_secs) as sum_total_secs&lt;BR /&gt;&amp;nbsp; , sum(total_mins) as sum_total_mins&lt;BR /&gt;&amp;nbsp; from work.worked2&lt;BR /&gt;&amp;nbsp; group by date, tactic&lt;BR /&gt;&amp;nbsp; order by date;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=work.daily_counts(obs=10);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 19:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/307997#M66015</guid>
      <dc:creator>jhlaramore</dc:creator>
      <dc:date>2016-10-28T19:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Summary (Counts and Sums)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/307998#M66016</link>
      <description>&lt;P&gt;I see no problem with your code. Run it and you should get what you are looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "MyData" - is it your input or your result of the code?&lt;/P&gt;
&lt;P&gt;It seems to me that you are looking at your input dataset, and not at your PROC PRINT result;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I'm wrong, please post your full log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What SAS installation (platform) are you using ?&lt;/P&gt;
&lt;P&gt;(Why using rsubmit - endrsubmit ?)&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 19:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/307998#M66016</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-10-28T19:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Summary (Counts and Sums)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/308042#M66034</link>
      <description>&lt;P&gt;Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use instruction here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; to transform your current SAS data set into data step code to post in the forum or attach as a text file.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2016 00:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Summary-Counts-and-Sums/m-p/308042#M66034</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-29T00:21:41Z</dc:date>
    </item>
  </channel>
</rss>

