[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Running different running sums

From   "Nick Cox" <>
To   <>
Subject   st: RE: Running different running sums
Date   Fri, 26 Oct 2007 18:15:08 +0100

Sounds like 

forval i = 1/30 { 
	gen cusum`i' = sum(x) in `i'/30 


Carlo Lazzaro
I would like to run  30 running sums concerning the number of blood
provided to a given set of patients with the data column reported below,
leaving one-out i per time. IOW, I would like to run a first running sum
with considering from i 1 to i 30; a second one including from i 2 to i
a third including from i 3 to i 30 and so forth, until the last 30th
sum, in which i 29 and i 30 should be included. 

I have tried - gen ALFA=sum(x) - but I have lost myself with imposing
different (and unsuccessful) conditions to make it work out. User's
and programming were not helpful. Any hints welcomed as ever. Thanks a
for your kindness and for your time. Kind Regards, Carlo.  

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index