Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: "First numlist in weights( ...) invalid" error when using tssmooth to calculate a simple moving average


From   Aaron Kirkman <ak1795mailserv@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: "First numlist in weights( ...) invalid" error when using tssmooth to calculate a simple moving average
Date   Thu, 6 Sep 2012 07:11:57 -0500

I noticed an error in the code I copied to the mailing list, although
it's merely a typo and fixing it doesn't correct the -numlist- error.
The -copy- line should not have a semicolon, and instead should be
this:

copy "http://ichart.finance.yahoo.com/table.csv?s=PNRA&a=05&b=10&c=1991&d=07&e=24&f=2012&g=d&ignore=.csv";
pnra.csv, replace

I can reproduce this error on both Unix and Windows machines (which
may not be relevant), but can anyone else reproduce this error with
the code in the previous thread?

Thank you,
Aaron Kirkman

On Wed, Sep 5, 2012 at 8:32 PM, Aaron Kirkman <ak1795mailserv@gmail.com> wrote:
> Dear Statalist,
>
> I'm using the -tssmooth- command to calculate a simple moving average
> of stock prices, but I get a syntax error of "First numlist in
> weights(1 2 3 4 <5>) invalid" when running these commands.
>
> ##
>
> copy "http://ichart.finance.yahoo.com/table.csv?s=PNRA&a=05&b=10&c=1991&d=07&e=24&f=2012&g=d&ignore=.csv";
> pnra.csv, replace
> insheet using pnra.csv, comma clear
> gen dateInt = date(date, "YMD")
> drop date
> rename dateInt date
> tsset date
> tssmooth ma wtma1 = adjclose, weights(1 2 3 4 <5>)
>
> ##
>
> I also receive an error if I specify other variations of this numlist
> or other weights entirely, e.g.
>
> tssmooth ma wtma2 = adjclose, weights(1/4 <5>)
> tssmooth ma wtma3 = adjclose, weights(1(1)4 <5>)
>
>
> Specifying a window does work, however.
>
> tssmooth ma wtma4 = adjclose, window(4 1)
>
> However, this syntax works for another data set, so I'm not quite sure
> about the problem with this code. For example, this code works when
> using a dataset from Baum's "Introduction to Modern Econometrics Using
> Stata."
>
> ##
>
> use http://www.stata-press.com/data/imeus/grunfeld, clear
> tsset
> tssmooth ma wtma1 = invest, weights(1 2 3 4 <5>)
> tssmooth ma wtma2 = invest, weights(1/4 <5>)
> tssmooth ma wtma3 = invest, weights(1(1)4 <5>)
>
> ##
>
> Is there a nuance to the syntax that I'm missing?
>
> Thank you,
> Aaron Kirkman
> *
> *   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/
*
*   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/


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