<?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: Conditional summarization with PROC SUMMARY ?? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51250#M14036</link>
    <description>&amp;gt; Why don't you request[pre]class classVar txtVAr1&lt;BR /&gt;
&amp;gt; ;[/pre]to get the 6 values?&lt;BR /&gt;
&lt;BR /&gt;
If you want only the cross product of the class variables but not the idividual summaries of each class variable use the NWAY option on the proc statement with this approach.</description>
    <pubDate>Fri, 10 Jul 2009 22:43:10 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2009-07-10T22:43:10Z</dc:date>
    <item>
      <title>Conditional summarization with PROC SUMMARY ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51247#M14033</link>
      <description>I typically write this type of code using PROC SQL statements but I'm trying to see if there are other ways of doing it using more inherent SAS code.&lt;BR /&gt;
&lt;BR /&gt;
I have a dataset that I want to summarize that has multiple recods per the class column that I'll be summarizing by.  What I would like to do is conditionally summarize the data (sales) based on another column in the set.&lt;BR /&gt;
&lt;BR /&gt;
Here is what I have:&lt;BR /&gt;
classVar: what I will summarize by (the CLASS statement)&lt;BR /&gt;
numVar1, numVar2 numVar3: the columns for the VAR statement&lt;BR /&gt;
txtVar1: the column that I want to conditionally summarize by&lt;BR /&gt;
&lt;BR /&gt;
This works to get totals (I know there are other nuances of writing the code):&lt;BR /&gt;
&lt;BR /&gt;
proc summary data=mydata;&lt;BR /&gt;
var numVar1 numVar2 numVar3;&lt;BR /&gt;
class classVar;&lt;BR /&gt;
types classVar; /* do not include the "total" row */&lt;BR /&gt;
output out=myoutput &lt;BR /&gt;
          sum(numVar1)=smVar1 &lt;BR /&gt;
          sum(numVar2)=smVar2 &lt;BR /&gt;
          sum(numVar3)=smVar3 &lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Does anyone know if you can conditionally sum .. for example if  txtVAr1 has two different options ("Yes" and "No" for example), can proc summary actually generate 6 output columns instead of just the 3 as seen above?&lt;BR /&gt;
&lt;BR /&gt;
I've google'd this to no result so if anyone has any insight, it would be greatly appreciated.  So far I'm coming to the conclusion that it's not possible and I just need to go back to PROC SQL and write the scripts myself.&lt;BR /&gt;
&lt;BR /&gt;
Thanks!&lt;BR /&gt;
Daniel</description>
      <pubDate>Thu, 02 Jul 2009 19:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51247#M14033</guid>
      <dc:creator>daveryBBW</dc:creator>
      <dc:date>2009-07-02T19:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summarization with PROC SUMMARY ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51248#M14034</link>
      <description>How about: &lt;BR /&gt;
1) create additional "count" columns based on some variable condition, or &lt;BR /&gt;
2) split your file into two files, perform two PROC SUMMARY executions under difference rqmts and then bring the two files back together (and maybe requiring a third PROC SUMMARY).&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 02 Jul 2009 19:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51248#M14034</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-07-02T19:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summarization with PROC SUMMARY ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51249#M14035</link>
      <description>Why don't you request[pre]class classVar txtVAr1 ;[/pre]to get the 6 values?</description>
      <pubDate>Fri, 03 Jul 2009 00:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51249#M14035</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-07-03T00:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional summarization with PROC SUMMARY ??</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51250#M14036</link>
      <description>&amp;gt; Why don't you request[pre]class classVar txtVAr1&lt;BR /&gt;
&amp;gt; ;[/pre]to get the 6 values?&lt;BR /&gt;
&lt;BR /&gt;
If you want only the cross product of the class variables but not the idividual summaries of each class variable use the NWAY option on the proc statement with this approach.</description>
      <pubDate>Fri, 10 Jul 2009 22:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Conditional-summarization-with-PROC-SUMMARY/m-p/51250#M14036</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2009-07-10T22:43:10Z</dc:date>
    </item>
  </channel>
</rss>

