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]

Re: st: Overwritten?


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Overwritten?
Date   Tue, 31 Dec 2013 02:39:41 +0000

I think it's best for everyone that you approach him privately. The
only safe speculation is that he's not a member of Statalist.
Nick
njcoxstata@gmail.com


On 31 December 2013 02:28, Francis, Richard N <rnfrancis@utep.edu> wrote:
> Nick,
>
> Thank you for your advice.
>
> In your experience, is there a reasonable expectation that the original author will alter the program?
>
> Rick
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: Monday, December 30, 2013 7:06 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: Overwritten?
>
> <>
> Side details first:
>
> A convention suggested for Statalist is to use notation such as -foo- to flag names of commands, variables, etc. as used in Stata. That way, for example, the word
>
> replace
>
> is to be understood as just ordinary English but the word
>
> -replace-
>
> is easy to spot as something that could be typed in Stata.
>
> A convention is just that, but I like the Statalist convention, and have often commended it. The different convention you're introducing here of using -FOO instead does not strike me as a good one, if only for the reason that upper case is usually not idiomatic Stata, but that's a personal view.
>
> For the record, -sroot- here is from Stata Journal 9(3) 2009.
>
> 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.
>
> Fixing this properly is the better solution, as then your overall problem should yield to -statsby-.
>
> Nick
> njcoxstata@gmail.com
>
>
> On 30 December 2013 21:59, Francis, Richard N <rnfrancis@utep.edu> wrote:
>
>> Have an option within a called program -SROOTFIX which generates residuals for a regression command.
>>
>> However, the variable containing the residuals -RES is absent.
>>
>> The called program -SROOTFIX actually calls another program -SROOT.
>>
>> Separate execution of -SROOT retains the residuals variable -RES, which suggests that something within the -SROOTFIX pgm overwrites the residuals variable -RES.
>>
>> The master program is as follows:
>>
>>  forval i = 1/`limit' {
>>          display "Iteration of `i' of `limit"
>>          replace which = "`: label (id) `i''" in `i'
>>          srootfix fcf if id == `i' , residuals(res)
>>                  qui foreach v in Z14 Z24 Z34 Z4t Z3t Z2t Z1t {
>>                   replace `v' = r(`v') in `i'
>>          }
>> }
>>
>> I have executed the program with the -replace command.
>>
>> However, the residuals variable -RES continues to be absent.
>>
>> The contents of -SROOTFIX are as follows:
>>
>> *! By Sergiy Radyakin, 2013
>> *! Fixes problem of -if- modifier [suspected] not working in public (SJ) version of -sroot-.
>> ** See http://www.stata.com/statalist/archive/2013-11/msg00366.html
>>
>> program define srootfix
>>    version 9.2
>>    syntax varname(ts) [if] [in] ,[*]
>>    preserve
>>    marksample touse
>>    keep if `touse'
>>    sroot `varlist' , `options'
>> end
>>
>> ** end of file **
>>
>> Any ideas for the absence of the residuals variable -RES are greatly appreciated.
>>
> *
> *   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/


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