Date: Tue, 21 Jan 1997 09:57:00 -0500
Reply-To: Dave_Mabey_at_RDA8POSTOFFICE1%RDCCMAIL%READERSDIGEST@RMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Dave_Mabey_at_RDA8POSTOFFICE1%RDCCMAIL%READERSDIGEST@RMAIL.COM
Subject: comm1-comm6 & SQL COALESCE function
Content-type: text/plain; charset=US-ASCII
New Forward Item:
---------------------------- Forwarded with Changes -----------------------
----
From: Dave Mabey at RDA8POSTOFFICE1
Date: 1/17/97 2:36PM
To: SAS-L@VM.MARIST.EDU@INTERNET at RDNOTES
To: j_weedon@ESCAPE.COM@INTERNET at RDNOTES
Subject: Re[2]: comm1-comm6 problem
---------------------------------------------------------------------------
----
New Text Item: Re: comm1-comm6 problem
Paul Kent at SAS Institute points out that the COALESCE function (SAS
Guide to the SQL Procedure page 161) can be used to find the first
non-missing value in a list of arguments. If one, and only one, "comm"
has a valid code while the rest have missing values, then the following
may be the simplest way to proceed.
PROC SQL;
select coalesce(comm1,comm2,comm3,comm4,comm5,comm6) as index,
count(*)
from comfile
group by index;
______________________________ Reply
Separator________________________________
On Thu, 16 Jan 1997 08:51:23 -0500, Lisa Bastian <eagle89@EROLS.COM> wrote:
>I have a total of about 67 codes (numeric), any of which can be found
>among six consecutive fields (comm1 comm6), although for each
>observation, a code can only show up once. Is there any "easy" way to
>count the occurrence of each individual code? ie., without an array and
>a bunch of "if" statements? Thanx.
|