Date: Tue, 5 Feb 2008 19:27:32 -0600
Reply-To: Yu Zhang <zhangyu05@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Yu Zhang <zhangyu05@GMAIL.COM>
Subject: Re: Proc Report Help
In-Reply-To: <ffb3381f739e5f4.47a8b59f@pace.edu>
Content-Type: text/plain; charset=ISO-8859-1
* The _rbreak_ doesn't exist. you can use option out= output the dataset.
take look at it, see if it helps you know better about the proc report. i
made some changes on your code, i am able to get what you descirbed.
HTH
YU
proc* *report* data=sashelp.class (where=(age in (*11*,*12*))) nowd out=out;
column name age sex height weight;
define age / order;
compute height;
if _break_='Age' and age=*11* then temp=height.sum;
else if _break_='Age' and age=*12* then temp1=height.sum;
endcomp;
break after age / summarize;
compute after;
if _break_="_RBREAK_" then height.sum=temp1-temp;
endcomp;
rbreak after / summarize;
*
run*;
On Feb 5, 2008 6:14 PM, Frida Aminova <faminova@pace.edu> wrote:
> Hello SAS Experts!
>
> I need your help in calculating a Net Assets column using Proc Report
> based on the SubTotals of Revenue and Expense columns. I have been working
> with the SAS Support, but my manager suggested that I also draw on your vast
> expertise. Below is something that I got from working with the SAS Institute
> Support Team:
>
> proc report data=sashelp.class nowd;
> column name age sex height weight;
> define age / order;
> compute height;
> if _break_=' ' and age=11 then temp=height.sum;
> else if _break_=' ' and age=12 then temp1=height.sum;
> endcomp;
> break after age / summarize;
> compute after;
> if _rbreak_=" " then height.sum=temp1-temp;
>
> endcomp;
> rbreak after / summarize;
> run;
>
> However, it doesn't seem to be working - essentially:
> if _rbreak_=" " then height.sum=temp1-temp; --> does not calculate the
> difference correctly
> Below is a snapshot of the output:
> Name Age Sex Height Weight
> Joyce 11 F 51.3 50.5
> Thomas M 57.5 85
> 11 108.8 135.5
> James 12 M 57.3 83
> Jane F 59.8 84.5
> John M 59 99.5
> Louise F 56.3 77
> Robert M 64.8 128
> 12 297.2 472
> 6 607.5
> As you can see, under the height, it does not give a correct value (297.2-
> 108.8 = 188.4).
> Can you please guide me in where there might be an issue? Or, have another
> example that I can use to calculate the difference between Revenue and
> Expense using Proc Report (in this case the height)?
>
> Any help from you will be greatly appreciated.
>
> Thank you,
> Frida
>
> Frida Aminova
> Programmer/Analyst
> Pace University - DoIT
>