Date: Sat, 1 Jun 2002 00:17:47 GMT
Reply-To: wpr <wpr@MIDSOUTH.RR.NOSPAM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: wpr <wpr@MIDSOUTH.RR.NOSPAM.COM>
Organization: RoadRunner - Midsouth
Subject: Re: Sums & Avgs of Variables in Dataset
Content-Type: text/plain; charset=us-ascii
First, thanks to everyone for their replies. I didn't realize how
complex this was going to be to explain. Here's another try. (This is
census 2000 data, so you can understand how complicated it is.)
Each dataset has about 200 variables, with names such as AVGHHINC20,
MEDINC35, WHITE00. The raw data is at a low level of detail, say
zipcode, and I want to get results at a higher level, say state. In
this small example, I want to calculate the means for the first two
variables, by state, and the sum of the third, by state. My first note
didn't make it clear that I want to calculate either the sum or the mean
for each variable, by the rollup identifier.
The reason for using Proc Transpose was to find a way to screen in or
out the variables by their names (use AVG and MED for means, all others
for sum; using Proc Means to do the summing and averaging).
I got some help from SAS today and it appears that Proc Transpose is the
way to go, using the _name_ variable and the correct syntax of the
Boolean logic. I will be using two steps of transposition to get what I
If anyone is interested in seeing how this works (I'm assuming I can get
it to work), I will be happy to post the results.
Thanks again for your comments.