Date: Sat, 11 Dec 2004 15:55:56 -0500
Reply-To: harry.droogendyk@RBC.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Harry Droogendyk <harry.droogendyk@RBC.COM>
Subject: Re: newbie - avg time / avg charge betwn visits???
Content-Type: text/plain; charset=iso-8859-1
See datepart() function to extract date portion only, see lag() function to
"remember" previous value of a field.
The first. and last. notation will enable you to detect when you have the
first or last row of the BY field, in this case member_no.
-----Original Message-----
From: haleyjo [mailto:haleyjo@GMAIL.COM]
Sent: Saturday, December 11, 2004 3:21 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: newbie - avg time / avg charge betwn visits???
I have data similar to the following for our medical office:
Member_no Visit_dt Visit_Chg
0001 22MAR2002:00:00:00 20.00
0001 22MAY2002:00:00:00 2.00
0001 22JUL2003:00:00:00 70.00
0001 22AUG2003:00:00:00 2.00
0001 22JAN2004:00:00:00 70.00
0002 29JUN2002:00:00:00 1.00
0002 15DEC2003:00:00:00 4.00
0003 22MAR2001:00:00:00 20.00
0003 22MAY2002:00:00:00 2.00
0003 22JUN2003:00:00:00 70.00
0003 29JUL2003:00:00:00 1.00
0003 15DEC2003:00:00:00 4.00
I want to find avg time between visits and avg cost between visits. In
other words, avg time between 1st visit and second visit (overall), avg
time between 2nd and 3rd, 3rd and 4th, 4th and 5th visits, etc. Then,
similarly, avg charge between 1st visit and second visit (overall),
etc.
I have been reading about first. and last. - but not sure how to get
the 2nd, 3rd and 4th. Just not sure where to begin. I need to make
each visit a varible, right? Would proc transpose help me? I also need
to get rid of the hrs, min, sec on the dates.
someone point me in the right direction? thankyou. haleyjo
------------------------------------------------------------
This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.
Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.
============================================================