Bookmark and Share

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: RE: RE: RE: RE: RE: RE: Extracting results from -rolling- in one file per window


From   Micha Schildmann <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: RE: RE: RE: RE: RE: Extracting results from -rolling- in one file per window
Date   Mon, 17 Mar 2014 15:43:20 +0000 (GMT)

Hm ok yea that was kind of obvious. Was probably a bit too late at that point. Thanks both of you for pointing my mistake out.

After stata first did not want to execute my rolling window due to "no; data in memory would be lost", I added a clear command to the code as can be seen below (the -preserve- and -restore- commands should be useless at that point, I just forgot to delete them). The comand executed and created several hundred files with the regression results. At that point I realized that I probably chose a wrong window size as I ony expected to get around 120 files as I wanted a rolling window increasing by a month, but got over 500 files (at that point I stopped the execution). My data is in daily format, but in weekly steps (so first observation at 01/02/04, second on 01/09/04) and by choosing a window of 4 I hoped to get monthly windows. Should I instead switch to a window of (30)or change the date to weekly format and then try 4 again? I checked the -rolling- but I am not sure if I understood it right.

Furthermore, after trying to adopt the code to have a rolling window of 30, the code did not work anymore although I used the code from the review of stata. Again, I got the "no; data in memory would be lost" error and using trace I get again



-------------------------------
  - if c(changed) {
  - di as error "no; data in memory would be lost"
no; data in memory would be lost
  - exit 4
-------------------------------

Deleting -preserve- and -restore- does not help.

I am a bit confused...

The code that worked one time but now does not looks like this.


global counter =0
capture program drop rollingwindow
program rollingwindow
global counter=$counter + 1
global tflist ""
foreach var of varlist *SA{
reg Mid `var'
tempfile tfcur
parmest, idstr("`var'") saving(`"`tfcur'"', replace) flis(tflist)
}
preserve
clear
append using $tflist
sencode idstr, gene(xvar)
lab var xvar "X-variable"
keybygen xvar, gene(parmseq)
drop if parmseq==2
egen rank = rank (-t)
drop if rank>30
save $counter, replace
restore
clear
end

rolling, window(4) stepsize (4) recursive: rollingwindow


Any help is much appreciated.

Best regards
Micha

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index