<?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: request for column sub totals in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/request-for-column-sub-totals/m-p/22713#M4985</link>
    <description>Some additional desk-checking, possibly?  Also, I recommend you add some SAS diagnostic commands, like a:&lt;BR /&gt;
&lt;BR /&gt;
 PUTLOG "&amp;gt;DIAG1&amp;gt;  I am here: " / _ALL_;  &lt;BR /&gt;
&lt;BR /&gt;
along the way in your DATA step to see what SAS is doing in your program.&lt;BR /&gt;
&lt;BR /&gt;
You never assign a NOTIX var in your DATA step just prior to OUTPUT.  Also, you should check the use of TOT variable.&lt;BR /&gt;
&lt;BR /&gt;
Maybe consider using a PROC SUMMARY approach, instead of a DATA step?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Thu, 23 Apr 2009 15:27:32 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-04-23T15:27:32Z</dc:date>
    <item>
      <title>request for column sub totals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/request-for-column-sub-totals/m-p/22712#M4984</link>
      <description>Hi,&lt;BR /&gt;
it may be simple issue but i am doing  some where wrong can any one help me&lt;BR /&gt;
to sort out&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;i would like to get total notix for each price&lt;/B&gt;&lt;BR /&gt;
data test1;&lt;BR /&gt;
input price	notix;&lt;BR /&gt;
cards;&lt;BR /&gt;
8	7&lt;BR /&gt;
0	1&lt;BR /&gt;
9	6&lt;BR /&gt;
10	4&lt;BR /&gt;
12	101&lt;BR /&gt;
13.5	2&lt;BR /&gt;
15	2&lt;BR /&gt;
16.5	62&lt;BR /&gt;
18	30&lt;BR /&gt;
0	2&lt;BR /&gt;
4.5	1&lt;BR /&gt;
9	200&lt;BR /&gt;
14	10&lt;BR /&gt;
16	75&lt;BR /&gt;
4.5	1&lt;BR /&gt;
9	140&lt;BR /&gt;
14	1&lt;BR /&gt;
16	52&lt;BR /&gt;
9	108&lt;BR /&gt;
14	1&lt;BR /&gt;
16	25&lt;BR /&gt;
0	8&lt;BR /&gt;
9	4&lt;BR /&gt;
13.5	2&lt;BR /&gt;
16.5	35&lt;BR /&gt;
18	669&lt;BR /&gt;
0	1&lt;BR /&gt;
9	6&lt;BR /&gt;
10	4&lt;BR /&gt;
12	101&lt;BR /&gt;
13.5	2&lt;BR /&gt;
15	2&lt;BR /&gt;
16.5	62&lt;BR /&gt;
&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=test1 out=test2;&lt;BR /&gt;
by price;&lt;BR /&gt;
run;&lt;BR /&gt;
 &lt;BR /&gt;
/* i got dataset like &lt;BR /&gt;
&lt;BR /&gt;
0.00  2&lt;BR /&gt;
0.00  5&lt;BR /&gt;
0.00  4&lt;BR /&gt;
1.00  8&lt;BR /&gt;
...........&lt;BR /&gt;
*/&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data test2;&lt;BR /&gt;
set test1;&lt;BR /&gt;
by price;&lt;BR /&gt;
retain tot1 tot;&lt;BR /&gt;
if first.price ne . then do;&lt;BR /&gt;
tot=price+1;&lt;BR /&gt;
price+1;&lt;BR /&gt;
tot1=tot+tot;&lt;BR /&gt;
end;&lt;BR /&gt;
if last.price then output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
i would like to see my output as&lt;BR /&gt;
&lt;BR /&gt;
price  nooftix&lt;BR /&gt;
0.00  19&lt;BR /&gt;
1.00  25&lt;BR /&gt;
2.25  38&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.</description>
      <pubDate>Thu, 23 Apr 2009 15:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/request-for-column-sub-totals/m-p/22712#M4984</guid>
      <dc:creator>ssas</dc:creator>
      <dc:date>2009-04-23T15:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: request for column sub totals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/request-for-column-sub-totals/m-p/22713#M4985</link>
      <description>Some additional desk-checking, possibly?  Also, I recommend you add some SAS diagnostic commands, like a:&lt;BR /&gt;
&lt;BR /&gt;
 PUTLOG "&amp;gt;DIAG1&amp;gt;  I am here: " / _ALL_;  &lt;BR /&gt;
&lt;BR /&gt;
along the way in your DATA step to see what SAS is doing in your program.&lt;BR /&gt;
&lt;BR /&gt;
You never assign a NOTIX var in your DATA step just prior to OUTPUT.  Also, you should check the use of TOT variable.&lt;BR /&gt;
&lt;BR /&gt;
Maybe consider using a PROC SUMMARY approach, instead of a DATA step?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 23 Apr 2009 15:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/request-for-column-sub-totals/m-p/22713#M4985</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-23T15:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: request for column sub totals</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/request-for-column-sub-totals/m-p/22714#M4986</link>
      <description>Hello Sams1,&lt;BR /&gt;
&lt;BR /&gt;
It should be ok now. There are two possible solutions, I think, as proposed by Scott.&lt;BR /&gt;
&lt;BR /&gt;
Yoba&lt;BR /&gt;
&lt;BR /&gt;
proc sort data=test1 out=test2;&lt;BR /&gt;
by price;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data test2(drop=notix);&lt;BR /&gt;
set test2;&lt;BR /&gt;
by price;&lt;BR /&gt;
if first.price then tot=0;&lt;BR /&gt;
tot+notix;&lt;BR /&gt;
if last.price then output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc means data=test1 noprint nway missing;&lt;BR /&gt;
var notix;&lt;BR /&gt;
class price;&lt;BR /&gt;
output out=test3(drop=_TYPE_) sum(notix)=sum_notix;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 23 Apr 2009 17:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/request-for-column-sub-totals/m-p/22714#M4986</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-23T17:56:42Z</dc:date>
    </item>
  </channel>
</rss>

