Date: Mon, 19 Mar 2007 11:58:25 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: A DATASET (probably retain statement) QUESTION
A very good idea to use min() and max() for that!
On Mon, 19 Mar 2007 15:47:20 +0000, Guido T <cymraegerict@GMAIL.COM> wrote:
>Hi,
>
>A little SQL ...
>
>proc sql;
> create table aresult as
> select player
> , case
> when min(score) eq 6 and max(score) eq 6 then 'A'
> when max(score) eq 6 then 'B'
> else 'C'
> end as result
> from somedata
> group by player
> ;
>quit;
>
>Regards
>++ Guido
>
>On 19/03/07, Rathindronath <mehedisas@yahoo.com> wrote:
>> I have a dataset as follows:
>>
>> Player Score
>> ------ ------
>> 1 1
>>
>> 2 1
>> 2 2
>> 2 2
>>
>> 3 1
>> 3 1
>> 3 2
>> 3 2
>> 3 3
>> 3 6
>>
>> 4 6
>> 4 6
>> 4 6
>> 4 6
>> 4 6
>>
>> The conditions are as follows:
>> ---------------------------------
>> if every score is 6 for a patient then flag = A
>> if some scores are 6 ( but not all)for a patient then flag = B
>> if none score is 6 for a patient then flag = C
>>
>>
>> I need a dataset as follows (RESULT):
>> ------------------------------
>>
>> Patient Score
>> ------- -----
>> 1 C
>> 2 C
>> 3 B
>> 4 A
>>
>>
>> Thanks in advance for your kind help.
>>
|