Statalist


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

st: RE: Running different running sums


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
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 
} 

Nick
n.j.cox@durham.ac.uk 

Carlo Lazzaro
 
I would like to run  30 running sums concerning the number of blood
tests
provided to a given set of patients with the data column reported below,
by
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
30,
a third including from i 3 to i 30 and so forth, until the last 30th
running
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
guide
and programming were not helpful. Any hints welcomed as ever. Thanks a
lot
for your kindness and for your time. Kind Regards, Carlo.  

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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