| Date: | Sun, 26 Feb 2012 16:23:31 +0000 |
| Reply-To: | "Zdeb, Michael S" <mzdeb@ALBANY.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Zdeb, Michael S" <mzdeb@ALBANY.EDU> |
| Subject: | Re: row total & col total add |
| In-Reply-To: | <CADquvYirDJ0hjbbU+1rEoSFj=UAPcnbJqDP8RMXp39i_AK0jDQ@mail.gmail.com> |
| Content-Type: | text/plain; charset="us-ascii" |
hi ... here's an example where you do not have to know the number of variables ...
* make a data set with just numeric variables;
data have;
set sashelp.class;
keep _numeric_;
run;
* vertical (column) sums;
proc summary data=have;
var _numeric_;
output out=sums (drop=_:) sum=;
run;
* horizontal (row) sums;
data sums;
if last then do;
set sums;
total = sum(of _numeric_) - last;
output;
end;
set new end=last;
total = sum(of _numeric_);
output;
run;
Mike Zdeb
U@Albany School of Public Health
One University Place (Room 119)
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
________________________________________
From: SAS(r) Discussion [SAS-L@LISTSERV.UGA.EDU] on behalf of sourav ghosh [mujamailkaro2010@GMAIL.COM]
Sent: Sunday, February 26, 2012 4:39 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: row total & col total add
hi,
I dont know about no of variables or columns , I am wondering any proc like
summary/means/report can generate the output or not
|