Date: Fri, 11 Sep 2009 03:48:02 -0700
Reply-To: Amar Mundankar <amarmundankar@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Amar Mundankar <amarmundankar@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: problem in data step
Content-Type: text/plain; charset=ISO-8859-1
On Sep 11, 2:16 pm, priyanka.priyankasi...@GMAIL.COM (priyanka singh)
wrote:
> Hi all,
>
> I have a very simple query. I am dealing with tick by tick data where I have
> a series of same prices at same time with some quantity.
> i have series like following:
>
> trade_id symbol series time price quantity day 3669684 ZEEL EQ 09:59:31
> 326.1 50 20080102 3670677 ZEEL EQ 09:59:36 326.5 100 20080102 3670718 ZEEL
> EQ 09:59:36 326.15 1 20080102 3670781 ZEEL EQ 09:59:36 326.5 250 20080102
> 3680180 ZEEL EQ 10:00:14 326.5 700 20080102 3681454 ZEEL EQ 10:00:20 326.5
> 25 20080102 3681979 ZEEL EQ 10:00:22 326.25 50 20080102 3682516 ZEEL EQ
> 10:00:24 326.5 1 20080102 3682517 ZEEL EQ 10:00:24 326.5 1 20080102
> 3682518 ZEEL EQ 10:00:24 326.5 1 20080102 3682519 ZEEL EQ 10:00:24 326.5 25
> 20080102 3682520 ZEEL EQ 10:00:24 326.8 22 20080102 3682832 ZEEL EQ
> 10:00:26 326.8 100 20080102 3684281 ZEEL EQ 10:00:32 326.5 20 20080102
> 3684684 ZEEL EQ 10:00:34 326.5 5 20080102 3684770 ZEEL EQ 10:00:35 326.4 45
> 20080102
> Now I want to add all the quantity whenever I have the same price time in
> consecutive trades.
>
> I had written this code, but it doesn't seem to work:
> data trial;
> set zeetele_08;
> if ((time= lag(time)) &(price= lag(price) ) then do;
> quantity = quantity + lag(quantity);
> end;
> run;
>
> Thanks & regards,
>
> Priyanka
Hi Priyanka,
Can you send the required output so that it will clarify the
problem ?
Regards,
Amar.
|