Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: replacing previous observations according to current observation, foreach? replace?
From
Nick Cox <n.j.cox@durham.ac.uk>
To
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject
RE: st: replacing previous observations according to current observation, foreach? replace?
Date
Mon, 6 Dec 2010 18:12:33 +0000
The continuation bracket /// can not be used interactively, only from a do-file or program.
Nick
n.j.cox@durham.ac.uk
Charlotte Picard
I am using Stata 11 IC, (64 bit Windows)
I tried copying and pasting the code from the website and still got the same issue. It seems that the error occurs at the 2nd line of the loop. I set trace on and got this:
[snip]
- by region: replace cases2 = cases[_n-`n']+cases2 ///
= by region: replace cases2 = cases[_n-1]+cases2 ///
invalid syntax
if cases2<0 & region[_n] == region[_n-`n']
di in r "Changes based on `n' Weeks Prior to Week `n' -->"
li if inlist(region, 2, 4) , sepby(region)
}
r(198);
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/