| Date: | Sun, 25 Jun 2000 15:05:02 -0700 |
| Reply-To: | Jay Zhou <zhou_jay@YAHOO.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Jay Zhou <zhou_jay@YAHOO.COM> |
| Subject: | Re: create an indicator |
|
| Content-Type: | text/plain; charset=us-ascii |
|---|
Xihu,
Try this:
proc sql;
create table result as
select *, max(v1) as group
from test
group by id;
quit;
Hope this helps,
Jay
--- xihu lu <xihulu@YAHOO.COM> wrote:
> Hello,
>
> I wonder if someone could help me out with my
> problem.
>
> I have a dataset:
>
> DATA TEST;
> INFILE CARDS;
> INPUT ID V1 ;
> CARDS;
> 1 1
> 1 1
> 1 2
> 2 1
> 2 1
> 3 1
> 3 2
> 3 3
> 4 1
> 4 1
> 5 2
> 5 2
> 5 2
> ;
> RUN;
>
> Now I want to create a V1 indicator. If V1 is all
> '1's
> for an id, V1 indicator would be '1'; if V1 has
> several
> values for an id, and the max value would be the V1
> indicator. So Id 3's V1 indicator is 3. So the
> result
> would
> look like:
>
> id V1 group
>
> 1 1 2
> 1 1 2
> 1 2 2
> 2 1 1
> 2 1 1
> 3 1 3
> 3 2 3
> 3 3 3
> 4 1 1
> 4 1 1
> 5 2 2
> 5 2 2
> 5 2 2
>
>
> I wonder how can I achieve this. Many thanks in
> advance!
>
> Please reply to my address as I am not on the
> mailing
> list.
>
>
> Xihu
>
>
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from
> anywhere!
> http://mail.yahoo.com/
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
|