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: Overwritten?


From   "Francis, Richard N" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Overwritten?
Date   Sat, 4 Jan 2014 03:01:37 +0000

Nick,

I asked the author of the user-written program -sroot- to kindly make a revision to his program, but he declined.

Previously, you suggested that I "would need to -save- the dataset you create each time and then -append- them all."

I included your previous message in part below to help refresh your memory:

> The nub of the matter I think is this. The program -srootfix-  by 
> Sergiy Radyakin  -preserve-s your original data, does some work and 
> when it's done -restore-s the original data. Thus it's futile adding 
> new variables to the dataset after -preserve-, as they will just 
> disappear at the -restore-. The -restore- is not explicit in the code, 
> but it's automatic given the -preserve-. The fact that -preserve- 
> requires a -restore- for the fix you originally asked for is explicit 
> in http://www.stata.com/statalist/archive/2013-11/msg00103.html
>
> Short of fixing a clone of -sroot- properly so that you don't need a work-around, or asking the original author to do that for you, it seems that you would need to -save- the dataset you create each time and then -append- them all.

My question is this: within the loop below, how would I go about saving the datasets each time?

forval i = 1/`limit' {
         display "Iteration of `i' of `limit"
         replace which = "`: label (id) `i''" in `i'
         srootfix fcf if id == `i' , residuals(rez)
         qui foreach v in Z14 Z24 Z34 Z4t Z3t Z2t Z1t {
                replace `v' = r(`v') in `i'
         }
}

I think I can merge the resulting datasets, just no clue how to save them within a loop.

Grateful for any direction you may suggest.

Thank  you,

Rick

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