LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (June 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 19 Jun 2003 11:57:41 -0600
Reply-To:   Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jack Hamilton <JackHamilton@FIRSTHEALTH.COM>
Subject:   Re: combine incomplete observations by var
Comments:   To: michelle@emode.com
Content-Type:   text/plain; charset=us-ascii

By default, PROC SUMMARY produces summaries for all combinations of the class variables, and also a grand total. If you specify NWAY, you will get only the lowest-level of combinations (highest level of detail). Since you have only one class variable, all NWAY does in this case is eliminate the total row.

MISSING says "keep observations with a missing value for one of the class variables". The default (in my opinion a bad choice) is to throw away those observations without warning. If you don't having any missing values, this has no effect, but I think it's good practice to always include it.

SUM= says that the kind of summariztion that you want is addition.

The _TYPE_ variable is used to distinguish the different levels of summarization. If NWAY is specified, _TYPE_ carries no information. If you had not specified NWAY, there would been two values of _TYPE_ in the output data set: 0 in the one row containing the grand total, and 1 in the detail rows.

-- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA

>>> "Michelle Jellinghaus" <michelle@emode.com> 06/19/2003 10:31 AM >>> This worked beautifully. Thank you very much for taking the time to answer my post.

I am still trying to figure out *why* it worked, however ;) I hope you won't mind a few questions.

This is what I have so far; will you let me know if I'm right? nway: this option removes an observation that contains a column sum for all rows missing: I'm not sure what this does here, but it seems to work :) sum= in the output statement: this seems to give a sum of all values in a column by class instead of returning M, STD, etc.

I see the _type_ column, but I don't understand what it is.

Thanks again for your help.

M

-----Original Message----- From: Jack Hamilton [mailto:JackHamilton@firsthealth.com] Sent: Wednesday, June 18, 2003 6:11 PM To: Michelle Jellinghaus; SAS-L@LISTSERV.UGA.EDU Subject: Re: [SAS-L] combine incomplete observations by var

If those are all the variables in the data set, you could do something like this (untested):

proc summary nway missing data=in_dsn; class date; var p1 p2 p3 p4; output out=out_dsn (drop=_type_ _freq_) sum=; run;

You could use PROC REPORT instead if you also want a printout at the same time.

-- JackHamilton@FirstHealth.com Manager, Technical Development Metrics Department, First Health West Sacramento, California USA

>>> "Michelle Jellinghaus" <michelle@EMODE.COM> 06/18/2003 5:22 PM >>> I have a data set that I would like to collapse based on date.

It looks something like this right now:

date p1 p2 p3 p4 4/5/03 40 . . . 4/5/03 . 30 . . 4/5/03 . . 20 . 4/5/03 . . . 10 4/6/03 50 . . . 4/6/03 . 40 . . 4/6/03 . . 40 . 4/6/03 . . . 30

And I'd like it to look something like this:

date p1 p2 p3 p4 4/5/03 40 30 20 10 4/6/03 50 40 40 30

This would provide me with one observation per date, with a complete set of values for each variable, ridding the data set of all missing values.

Any ideas would be very much appreciated.

Thank you,

Michelle


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