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: Rolling regression without "clear"
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Rolling regression without "clear"
Date
Thu, 13 Jun 2013 11:45:38 +0100
There is no difference in principle. Even if you have a stored scalar, say
scalar foo = 42
you can supply its value like this
... , window(`=foo')
so that what happens is
1. Stata sees the expression to be evaluated `=foo' -- goes then
into a corner -- and comes back with the result of that evaluation,
here 42
2. -rolling- itself sees -window(42)- and moves on.
If your name could be confused with a variable name, then
..., window(`=scalar(foo)')
disambiguates. Documentation starts at -help macro-, but you have to
dig a bit deep to see it from documentation.
For a local macro,
..., window(`foo')
would work, but for a scalar, a beast of a different kind, syntax is
slightly different.
Nick
[email protected]
On 13 June 2013 11:33, G. Anderson <[email protected]> wrote:
> Great. Thanks Nick.
>
> Do you know whether it's possible to set the window size based on a stored
> scalar, rather than typing in the number?
>
> Thanks,
>
> Gareth
>
>
>
> On Jun 13 2013, G. Anderson wrote:
>
>> Hi,
>>
>> I am using the "rolling" command in Stata 12 to do rolling
>> regressions.However when I use
>>
>> rolling , window(150):regress depvar indvar
>>
>> I get the error message "no; data in memory would be lost"
>>
>> The only way I can get around this is by adding in the "clear" command,
>> but this deletes all of my dataset, which is not ideal. Is there a way
>> around this?
>>
>>
>> Thanks,
>>
>> Gareth
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/