Date: Wed, 9 Jan 2008 14:02:48 -0500
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ya Huang <ya.huang@AMYLIN.COM>
Subject: Re: Help needed for summary of data
One SQL should be enough:
proc sql;
select *,case when count(distinct type)=1 and max(type)='S' then 'Y'
else 'N' end as flag
from one
group by hhkey
;
hhkey type flag
------------------------
11 D N
11 S N
11 D N
12 S Y
12 S Y
13 D N
13 D N
14 S Y
On Wed, 9 Jan 2008 08:36:13 -0800, cherub <cherub2life@YAHOO.COM> wrote:
>I have a dataset just like this:
> data 1;
> input hhkey type$;
> 11 S
> 11 D
> 11 D
> 12 S
> 12 S
> 13 D
> 13 D
> 14 S
> ;
> run;
>
> I need to summary this data and generate a indicator, if all types for a
hhkey are "S" then this indicator is 'Y', just like hhkey 12 and 14, this
indicator is 'Y'.
>
> Does anybody know to generate this indicator?
>
> Thanks
>
>
>---------------------------------
>Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
now.
|