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]
st: AW: Response from Stata listserv
From
"Martin Weiss" <[email protected]>
To
<[email protected]>
Subject
st: AW: Response from Stata listserv
Date
Mon, 29 Mar 2010 17:52:58 +0200
<>
Forwarded on behalf of Jeff.
HTH
Martin
Von: [email protected] [mailto:[email protected]]
Gesendet: Montag, 29. März 2010 16:52
An: [email protected]
Betreff: Response from Stata listserv
Dear Martin:
Thank you for your prompt reply re: my posting on the Stata listserv. This
strategy fixed the issue.
Could I kindly ask a follow-up question as well? When I use the tssmooth
function to create 2 or 5 year moving averages, Stata calculates these
moving averages until the end of the time-series rather than stopping 1 year
(in the case of the 2 year moving average) or 4 years (in the case of the 5
year moving average) before the end of the time-series? It thus counts
forward missing values as zero. Would you know a possible strategy to fix
this problem as well?
Thanks, Jeff
________________________________________
Date: Thu, 25 Mar 2010 14:57:15 +0100
From: "Martin Weiss" <[email protected]>
Subject: st: AW: Tssmooth Ma Missing Values
<>
You can change the values after the fact:
*************
clear*
input str10 Country Year byte Variable
Australia 1897 .
Australia 1898 .
Australia 1899 .
Australia 1900 .
Australia 1901 0
Australia 1902 1
Australia 1903 2
Australia 1904 3
Australia 1905 4
Australia 1906 5
Australia 1907 6
Australia 1908 7
Australia 1909 8
Australia 1910 9
Australia 1911 10
Australia 1912 .
end
tsset Year, yearly
tssmooth ma twoyearMA=Variable, window(0 1 1)
tssmooth ma fiveyearMA=Variable, window(0 1 4)
tssmooth ma back2yearMA=Variable, window(1 1 0)
foreach var of varlist *yearMA{
replace `var'=. if mi(Variable)
}
list, noo
Jeffrey Chwieroth
Senior Lecturer in International Political Economy
London School of Economics
Department of International Relations
Houghton Street
London WC2A 2AE
Tel: [+44] (0) 20 7955 7209
Fax: [+44] (0) 20 7955 7446
Homepage: http://personal.lse.ac.uk/Chwierot/
Please access the attached hyperlink for an important electronic
communications disclaimer:
http://www.lse.ac.uk/collections/planningAndCorporatePolicy/legalandComplian
ceTeam/legal/disclaimer.htm
*
* 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/