Date: Thu, 6 Nov 2008 10:39:16 -0500
Reply-To: Jim Groeneveld <jim.1stat@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim.1stat@YAHOO.COM>
Subject: Re: SAS doubt
Hi Priya,
At first sight I would say it can be done with PROC TRANSPOSE or my MR2RM
macro (http://tinyurl.com/2okul8). But at second sight it should be done
conditionally and then a dedicated data step is the best way. However, you
say that it should only be done if the difference is less than 30 minutes
or 1800 seconds. Your difference is negative, or should it be absolute? In
the absolute sense it is 37100, so much longer than half an hour. Can you
explain? And where has the value 95959 been left?
Anyway, *untested* code would be:
DATA New (DROP=Next:);
SET Old Old (FIRSTOBS=2 RENAME=(CustNo=NextCustNo StdCal=NextStdCal
Call1=Call4 Call2=Call5 Call3=Call6));
RETAIN DeleteNext 0;
IF (DeleteNext) THEN DELETE; * From previous record;
DeleteNext = 0;
IF (NextCustNo EQ CustNo AND [your condition involving the difference
between StdCal and NextStdCal]) THEN
DeleteNext = 1;
ELSE DO;
Call4 = .; Call5 = .; Call6 = .;
END;
RUN;
The data need not to be sorted by CustNo, but it would be most logical if
it was or if same CustNo values occurred consecutively.
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
On Thu, 6 Nov 2008 03:54:05 -0800, priya4484@GMAIL.COM wrote:
>one tech doubt
>
>i have a dataset .. with example data
>custno stdcal(in secs) call1 call2 call3
>
>101 58859 4454 5656 5666
>101 95959 4499 5995 2002
>102 33445 5556 5888 5599
>
>Assume that in the firts by group (101) the diff between stdcal (58859
>- 95959) < 30 mins, then the out put i require is
>
>custno stdcal(in secs) call1 call2 call3 call4 call5 call6
>
>101 58859 4454 5656 5666 4499 5995 2002
>102 33445 5556 5888 5599 . . .
>
>is it fine?