<?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: proc summary? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/proc-summary/m-p/20031#M4141</link>
    <description>You will want to consider using a DATA step and with a sorted input file look to using BY group processing.  You can accumulate (SUM function to a new "total" variable) observations that meet your data criteria.  The BY group processing takes a list of BY group variables and also a "break" variable -- you will be using IF &lt;EXPRESSION&gt; / THEN &lt;ASSIGNMENT&gt;;  statements in your DATA step to do the numeric variable aggregation.&lt;BR /&gt;
&lt;BR /&gt;
The BY group processing topic is discussed in the SAS DOC - suggest doing a Google search to find suitable reference material on the SAS support website.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
data step processing site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
by group processing site:sas.com&lt;/ASSIGNMENT&gt;&lt;/EXPRESSION&gt;</description>
    <pubDate>Wed, 12 May 2010 02:28:18 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-05-12T02:28:18Z</dc:date>
    <item>
      <title>proc summary?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-summary/m-p/20030#M4140</link>
      <description>I have a dataset that looks like the one below.  The date column is sorted. I’m trying to create a table which will summarize &lt;BR /&gt;
•	If the “first” purchase in 2005 is product ‘2’ and then&lt;BR /&gt;
•	How many units of products 7 &amp;amp; 9 were bought by the person (ID) over the following years&lt;BR /&gt;
I tried using Proc Summary. The problem is that there are multiple cases in which the person bought products 2 along with something else on their first purchase in 2005 (hence the multiple units &amp;amp; cost entries in certain rows). I have put them with commas to make a distinction. However, my dataset has them in the same box and separated by a space.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
ID	date	      product	units	cost($)	trip&lt;BR /&gt;
1	1/28/2005	 2	         1	 20	1&lt;BR /&gt;
1	2/3/2005	 99	         1	 24	2&lt;BR /&gt;
1	2/4/2007	 9	         1	 24	3&lt;BR /&gt;
1	4/13/2008	 8	         1	 30	6&lt;BR /&gt;
1	7/27/2008	 8	         1	 30	7&lt;BR /&gt;
1	11/9/2009	 8	         1	 30	8&lt;BR /&gt;
2	7/31/2005	 7	         1	 25	1&lt;BR /&gt;
2	3/20/2006	 9	         1	 24	2&lt;BR /&gt;
2	1/12/2007	 9	         1	 14	3&lt;BR /&gt;
2	2/6/2008	 9	         1	 40	4&lt;BR /&gt;
2	10/16/2009 9	         1	 19	5&lt;BR /&gt;
3	3/24/2005	 2,9	         1,1	 40	1&lt;BR /&gt;
3	10/18/2006 4	         3	 45	2&lt;BR /&gt;
3	5/6/2007	 2	         1	 39	3&lt;BR /&gt;
3	5/7/2007	 99	         1	 39	4&lt;BR /&gt;
3	4/17/2005	 2,9	         3,2 	 75,120	1&lt;BR /&gt;
3	4/23/2005	 7, 9	        1,1	 25,40	2</description>
      <pubDate>Wed, 12 May 2010 02:05:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-summary/m-p/20030#M4140</guid>
      <dc:creator>spg</dc:creator>
      <dc:date>2010-05-12T02:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: proc summary?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/proc-summary/m-p/20031#M4141</link>
      <description>You will want to consider using a DATA step and with a sorted input file look to using BY group processing.  You can accumulate (SUM function to a new "total" variable) observations that meet your data criteria.  The BY group processing takes a list of BY group variables and also a "break" variable -- you will be using IF &lt;EXPRESSION&gt; / THEN &lt;ASSIGNMENT&gt;;  statements in your DATA step to do the numeric variable aggregation.&lt;BR /&gt;
&lt;BR /&gt;
The BY group processing topic is discussed in the SAS DOC - suggest doing a Google search to find suitable reference material on the SAS support website.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search arguments, this topic/post:&lt;BR /&gt;
&lt;BR /&gt;
data step processing site:sas.com&lt;BR /&gt;
&lt;BR /&gt;
by group processing site:sas.com&lt;/ASSIGNMENT&gt;&lt;/EXPRESSION&gt;</description>
      <pubDate>Wed, 12 May 2010 02:28:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/proc-summary/m-p/20031#M4141</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-05-12T02:28:18Z</dc:date>
    </item>
  </channel>
</rss>

