LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 11 Apr 2011 14:44:04 -0400
Reply-To:     "Bian, Haikuo" <HBian@FLQIO.SDPS.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Bian, Haikuo" <HBian@FLQIO.SDPS.ORG>
Subject:      Re: Proc sql - summary
Comments: To: Kevin Y <kevin77711@YAHOO.COM>
In-Reply-To:  <71622.58636.qm@web59616.mail.ac4.yahoo.com>
Content-Type: text/plain; charset="utf-8"

Kevin,

I am not sure if I understand what you really want, but it seems to me that a simple sum() will do:

data have; input id $ var1-var5; cards; A 2 3 4 5 6 B 4 5 6 7 8 C 1 2 3 4 5 ; run;

proc sql; create table need as select sum(var1) as var1, sum(var2) as var2, sum(var3) as var3, sum(var4) as var4, sum(var5) as var5 from have; quit;

proc print; run;

Regards, Haikuo

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Kevin Y Sent: Monday, April 11, 2011 2:27 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Proc sql - summary

I always use SPL to get summary of a variable (using “sum, group by”). But now I have difficulty how to summary multiple variables using SQL. I know that I can use PROC SUMMARY to get what I want, but I just wonder is there way to do it by SQL, please? Thanks datahave; inputid $ var1=var5; cards; A 2 3 4 5 6 B 4 5 6 7 8 C 1 2 3 4 5 ; run; listingwant; var1-var5 tot 710131619;

----------------------------------------- Email messages cannot be guaranteed to be secure or error-free as transmitted information can be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The Centers for Medicare & Medicaid Services therefore does not accept liability for any error or omissions in the contents of this message, which arise as a result of email transmission.

CONFIDENTIALITY NOTICE: This communication, including any attachments, may contain confidential information and is intended only for the individual or entity to which it is addressed. Any review, dissemination, or copying of this communication by anyone other than the intended recipient is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message.


Back to: Top of message | Previous page | Main SAS-L page