Date: Wed, 5 Sep 2007 15:16:28 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: SAS coding help
On Wed, 5 Sep 2007 08:48:14 -0700, cherub <cherub2life@YAHOO.COM> wrote:
>Hi,
>
> I need some help for my coding. Now I have a dataset sorted by date and
id(see below)
>
> Id date key
> 12 12May2001 1254
> 12 13Dec2004 1204
> 12 15Jan2005 1002
> 15 15Apr1998 0998
> 15 05Feb2000 0147
> ......
>
> I need to generate a new variable which can give the rank for date by id,
such as
>
> Id date Key rank
> 12 12May2001 1254 1
> 12 13Dec2004 1204 2
> 12 15Jan2005 1002 3
> 15 15Apr1998 0998 1
> 15 05Feb2000 0147 2
> ......
>
> Does somebody know how to generate this variable?
>
> Thanks
>
>
> Yanyan
Are there any ties (repetition of ID/DATE value pairs)? Then the DATA step
counters and PROC RANK will give different results. You have to indicate how
ties should be handled.
|