| Date: | Wed, 20 May 2009 17:18:42 +0530 |
| Reply-To: | "Kanimozhi A." <kanimozhi.a@ECRONACUNOVA.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Kanimozhi A." <kanimozhi.a@ECRONACUNOVA.COM> |
| Subject: | Re: Need help for finding Difference |
|
| In-Reply-To: | A<A5123C7EAAF1154BBAE254299B00A05306E452A6@GCPWINHYD2EVS02.IND.CORP.AD> |
| Content-Type: | text/plain; charset="us-ascii" |
Raghupathi,
Can you try the following code? It works.
DATA TEST;
INPUT Member_id patient_id serviced_dte mmddyy11.;
format serviced_dte date9.;
CARDS;
7845 10412 4/24/2006
7845 11592 4/24/2006
7845 25390 4/24/2006
7845 26515 4/24/2006
7845 10412 7/6/2006
7845 25390 7/13/2006
7845 11592 7/13/2006
7845 26515 7/13/2006
7845 11592 11/6/2006
7845 25390 11/6/2006
7845 10412 11/6/2006
7845 26515 11/6/2006
7845 25390 1/12/2007
7845 10412 1/12/2007
7845 26515 1/12/2007
7845 11592 2/24/2007
7845 10412 5/8/2007
7845 25390 5/8/2007
7845 26515 5/8/2007
7845 11592 5/8/2007
7845 10412 8/6/2007
7845 26515 8/6/2007
7845 11592 8/6/2007
7845 25390 8/6/2007
7845 11592 10/14/2007
;
RUN;
proc sort data=test;
by serviced_dte;
run;
data test1;
format date date9.;
set test;
by serviced_dte;
if first.serviced_dte then date=lag(serviced_dte);
diff=serviced_dte-date;
Drop date;
run;
Regards,
Kanimozhi
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of N,
Raghupathi
Sent: Wednesday, May 20, 2009 3:56 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Need help for finding Difference
Hi all,
I have a dataset in the following way I need to find the difference
between the serviced_dte for member_id based on patient_id. Since each
member will have many patients with in each member. For example the
difference between the 4/24/2006 and 7/6/2006 =73 days and so on
Member_id
patient_id
serviced_dte
7845
10412
4/24/2006
7845
11592
4/24/2006
7845
25390
4/24/2006
7845
26515
4/24/2006
7845
10412
7/6/2006
7845
25390
7/13/2006
7845
11592
7/13/2006
7845
26515
7/13/2006
7845
11592
11/6/2006
7845
25390
11/6/2006
7845
10412
11/6/2006
7845
26515
11/6/2006
7845
25390
1/12/2007
7845
10412
1/12/2007
7845
26515
1/12/2007
7845
11592
2/24/2007
7845
10412
5/8/2007
7845
25390
5/8/2007
7845
26515
5/8/2007
7845
11592
5/8/2007
7845
10412
8/6/2007
7845
26515
8/6/2007
7845
11592
8/6/2007
7845
25390
8/6/2007
7845
11592
10/14/2007
I need to obtain the output in this form
Member_id
patient_id
serviced_dte
Difference in days
7845
10412
4/24/2006
7845
11592
4/24/2006
7845
25390
4/24/2006
7845
26515
4/24/2006
7845
10412
7/6/2006
73.00
7845
25390
7/13/2006
7.00
7845
11592
7/13/2006
7845
26515
7/13/2006
7845
11592
11/6/2006
116.00
7845
25390
11/6/2006
7845
10412
11/6/2006
7845
26515
11/6/2006
7845
25390
1/12/2007
67.00
7845
10412
1/12/2007
7845
26515
1/12/2007
7845
11592
2/24/2007
43.00
7845
10412
5/8/2007
73.00
7845
25390
5/8/2007
7845
26515
5/8/2007
7845
11592
5/8/2007
7845
10412
8/6/2007
90.00
7845
26515
8/6/2007
7845
11592
8/6/2007
7845
25390
8/6/2007
7845
11592
10/14/2007
69.00
Thanks in advance,
Raghu
This e-mail (and any attachments), is confidential and may be
privileged. It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or
attachments) and disclosure or copying of its
contents or any action taken in reliance on it is unlawful. Unintended
recipients must notify the sender immediately
by e-mail/phone & delete it from their system without making any copies
or disclosing it to a third person.
!! Disclaimer Message !!
The information contained in this communication is intended solely for the use of the individual or entity to whom
it is addressed and others authorized to receive it. It may contain confidential or legally privileged information.
If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking
any action in reliance on the contents of this information is strictly prohibited and is unlawful. If you have received
this communication by error, please notify us immediately by responding to this email and then delete it from your
system & backup. ECRON ACUNOVA is not liable for any improper and/or incomplete transmission of the information contained
in this communication or for any delay in its receipt or for any damage caused by malicious code or alteration by any
third party. The contents of this email do not necessarily represent the views or policies of ECRON ACUNOVA
!! End Of Disclaimer Message !!
|