```Date: Mon, 12 Jul 2004 16:34:41 -0400 Reply-To: Howard Schreier Sender: "SAS(r) Discussion" From: Howard Schreier Subject: Re: NEED HELP in double summing of cross multiplication..PLS!!! Or (also tested) proc sql; create table ff as select ee.day, sum(ee.x * cross.x) as xday from ee inner join ee as cross on ee.day=cross.day where ee.hour wrote: >'Scuse me for barging in ... > >Like Howard, I didn't fully grasp your problem (still >don't). You have intra-day returns on traded equity >securities? Are you trying to derive daily returns >from the intra-day returns? It may be beneficial to >further explain what you're trying to do. > >As to the mechanics of what you ask, it is less >problematical. > >Suppose that a trading day consisted of 5 hours, >a measurement being made at the end of each hour. >The following tested code may suggest an approach: > >data ee; > do day = 1 to 2; > do hour = 1 to 5; > x + 1; > output; > end; > end; > run; > >data ff(keep = day hour xday); > array xx(999); > > do i = 1 by 1 until (last.day); > set ee; by day; > xx(i) = x; > end; > > do j = 1 to i - 1; > do k = j + 1 to i; > xday = sum(xday, xx(j) * xx(k)); > end; > end; > > put day= hour= xday=; > run; > > >Hope it hep's ... > > Cheers, > Puddin' > >******************************************************* >***** Puddin' Man **** Pudding_Man-at-mail.com ******** >*******************************************************; > >----- Original Message ----- >From: Marky >Date: Sun, 11 Jul 2004 14:56:59 -0700 >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: NEED HELP in double summing of cross multiplication..PLS!!! > >Ok- here is example let's assume that 1 day is divided into 5 >observations,so daily cross-multiplications are: > >Observations: Output : > x > 1 1*2 + 1*3 + 1*4 + 1*5 + > 2 2*3 + 2*4 + 2*5 + > 3 3*4 + 3*5 + > 4 4*5 = > 5 = 85 > 6 6*7 + 6*8 + 6*9 + 6*10 + > 7 7*8 + 7*9 + 7*10 + > 8 8*9 + 8*10 + > 9 9*10 = > 10 =635 > >and so on. > > > >Howard_Schreier@ITA.DOC.GOV (Howard Schreier) wrote in message news:<200407110317.i6B3Hd214519@listserv.cc.uga.edu>... >> So you have about 350 trading days (350 x 72 = 25,200). >> >> Why don't you post a mini example (perhaps 2 days x 4 intervals per day) >> and show both the input data and expected results? >> >> On Sat, 10 Jul 2004 11:28:26 -0700, Marky wrote: >> >> >Hi Fellows, >> > >> >I have a problem with following matter: >> > >> >I have about 25000 observations which are 5-minute returns of certain >> >equity (equivalent to 1.5 year). I need to create a formula that >> >computes a sum of cross multiplications every 72 (here 72 equals 1 >> >day)observations. Formula is as follows: (sum from i=1 to 71)(sum from >> >j=i+1 to 72) r(i)*r(j) >> > >> >where r(i) is return in time i >> > >> >PLEASE help me with that. I only made a formula that computes sum of >> >multiplication over all observations, but it is useless for me ;( >> > >> >THANKS for help >-- >___________________________________________________________ >Sign-up for Ads Free at Mail.com >http://promo.mail.com/adsfreejump.htm ```

Back to: Top of message | Previous page | Main SAS-L page