sas >> Grand total in PROC SQL
by mlhoward » Sat, 07 Jun 2008 03:39:53 GMT
Irin,
Here's what your code looks like below- please fix! I pulled it into =
Word and got rid of the symbols:
I am calculating sum of variables grouped by region. And I wonder how to =
create a grandtotal for each of variables?
For example:
SUMTOT_pt sumtot_cov
***************************************
MIDWEST 1,000,000 70,000,000
WEST 2,000,000 60,000,000
NORTHHEAST 3,000,000 50,000,000
ETC 4,000,000 10,000,000
**********************************8*****
Grandtot 10.000,000 190,000,000
=20
=20
Proc SQL ;
Create Table PR As
Select region,sum(patients) as sumtot_pt,
sum(covered) as sumtot_cov,
From PR_all
Group By region;
Quit ;
=20
How should I adjust my code? =20
Thank you in advance,
=20
Irin
As to how to get a grand total, it really isn't normal to do this in =
Proc SQL; you should use Proc REPORT instead, which can do this easily.
-Mary
----- Original Message -----=20
From: Irin later=20
To: XXXX@XXXXX.COM =20
Sent: Friday, June 06, 2008 1:29 PM
Subject: Grand total in PROC SQL
I am calculating sum of variables grouped by region. And I wonder how =
to create a grandtotal for each of variables?
For example:
=
&=
nbsp; SUMTOT_pt sumtot_cov
***************************************
MIDWEST =
1,000,000 70,000,000
WEST =
2,000,000 60,000,000
NORTHHEAST 3,000,000 =
50,000,000
ETC =
4,000,000 10,000,000
**********************************8*****
Grandtot 10.000,000 =
190,000,000
Proc SQL ;
Create Table PR As
Select region,sum(patients) as sumtot_pt,
=
&=
nbsp; sum(covered) as sumtot_cov,
From PR_all
Group By region;
Quit ;
How should I adjust my code?
Thank you in advance,
Irin