Statalist


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

st: R: RE: Running different running sums


From   "Carlo Lazzaro" <carlo.lazzaro@tin.it>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: R: RE: Running different running sums
Date   Fri, 26 Oct 2007 19:31:36 +0200

Dear Nick,

thanks as ever for your kindness and for your time.

Kind Regards,

Carlo

-----Messaggio originale-----
Da: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Per conto di Nick Cox
Inviato: venerd́ 26 ottobre 2007 19.15
A: statalist@hsphsun2.harvard.edu
Oggetto: st: RE: Running different running sums

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/


*
*   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