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 (July 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 7 Jul 2008 14:31:47 +0000
Reply-To:     iw1junk@COMCAST.NET
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <iw1junk@COMCAST.NET>
Subject:      Re: How To Quickly Examine Multiple Fields and Select Nonmissing
              Value(s)
Comments: cc: Takeadoe <mtonkovich@MSN.COM>

Summary: Data structure determines algorithm, hence programming effort. #iw-value=1

Takeadoe,

data w ; input id1-id6 ; seq = _n_ ; cards ; ID1 ID2 ID3 ID4 ID5 ID6 6 . . . . . . 98 . . . . . . 76 76 . . 8 . . . . . ;

proc transpose data = w out = t ; by seq ; var id1-id6 ; run ;

proc sort data = t nodupkey out = t2 ( keep = col1 rename = ( col1 = id )) ; where not missing ( col1 ) ; by col1 ; run ;

proc print data = t2 ; run ;

Ian Whitlock ===============

Date: Mon, 7 Jul 2008 07:13:06 -0700 Reply-To: Takeadoe <mtonkovich@MSN.COM> Sender: "SAS(r) Discussion" From: Takeadoe <mtonkovich@MSN.COM> Organization: http://groups.google.com Subject: How To Quickly Examine Multiple Fields and Select Nonmissing Value(s) Comments: To: sas-l Content-Type: text/plain; charset=ISO-8859-1

Good morning,

I've got a job that needs far more experience than I have. A sample of the dataset follows: I'm using "m" to indicate missing value.

ID1 ID2 ID3 ID4 ID5 ID6 6 m m m m m m 98 m m m m m m 76 76 m m 8 m m m m m

My goal is a dataset that looks like this:

ID 6 98 76 8

So, how can I easily check each of the 6 ID fields and assign the nonmissing value to the new variable ID? Note that there will be an occassion where a record may contain 2 or more nonmissing values. The values will be the same in all cases when that happens.

Any help at all, would be great. The dataset is nearly 1,000,000 records.


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