Statalist


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

st: re: error in my loop


From   Kit Baum <kitbaum@mac.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: re: error in my loop
Date   Sat, 8 Dec 2007 16:05:05 -0500

An easier way to do what Stephanie is trying to do avoids having to store and unstore variables in matrices by storing the weighting coefficients as local macros rather than vectors:

local d3 0.1942 0.2809 0.3832 -0.8582
egen FpriceAlt = filter(price), lags(0/-3) coef(`d3')
su F*

This uses -filter()- from the egenmore package (findit egenmore). It could be easily 'motorized' per my last example to operate
over a number of variables and filter lengths.

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* 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–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index