[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: please help
From:       evallyne sikuku <esimuli () LIVE ! COM>
Date:       2009-09-07 14:25:40
Message-ID: SNT116-W65AEF0A7A70B24D07CBBC7C1EB0 () phx ! gbl
[Download RAW message or body]

Thanks Joe...that was fast....thanks again
 


Date: Mon, 7 Sep 2009 09:18:33 -0500
Subject: Re: please help
From: snoopy369@gmail.com
To: esimuli@live.com
CC: SAS-L@listserv.uga.edu

Assuming data have; (your data); run; then:
proc sort data=have; by pid date; run;

data want;
 set have;
 by pid date;
 retain visit;
 if first.pid then visit=1;
 else visit+1;
run;

-Joe


On Mon, Sep 7, 2009 at 9:13 AM, evallyne sikuku <esimuli@live.com> wrote:

Hi all,

I need some help

How can I automatically generate a count for the visits of patients coming to the \
clinic where every visit per patient will have visit number.

If my data looks like this;

current data







pid
date

1
1/1/2009

1
2/1/2009

1
4/2/2009

1
28/3/2009

2
4/6/2008

2
3/1/2009

2
4/2/2009

3
14/1/2009

3
20/3/2009



and I want the new data to have the visit_count as follow







pid
date
visit_count

1
1/1/2009
1

1
2/1/2009
2

1
4/2/2009
3

1
28/3/2009
4

2
4/6/2008
1

2
3/1/2009
2

2
4/2/2009
3

3
14/1/2009
1

3
20/3/2009
2



Thanks guys

Eva







_________________________________________________________________
With Windows Live, you can organize, edit, and share your photos.
http://www.microsoft.com/middleeast/windows/windowslive/products/photo-gallery-edit.aspx


_________________________________________________________________
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx=


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic