Dear Statalisters,
I detected a strange bug with the the seasonal differencing time-series operator. When I generate a new variable as
newvar will actually not be the zeroth seasonal difference (which by definition should be a variable containing only zeros because oldvar is to be subtracted from itself) but the first seasonal difference of oldvar. When instead using the operator S0 with the summarize command, it produces the correct statistics (zero mean, variance etc.) but in the table it is labeled as S1.
See the following example:
As you can see, in the summarize table, S1.gnp appears twice in the first column but the statistics refer once to S0.gnp and once to S1.gnp. When first generating new variables, gnp_s0 = S0.gnp is actually generated identically to gnp_s1 = S1.gnp.
I could confirm the problem with Stata versions 10, 11, 12, and 13, but I do not yet have access to Stata 14.
While the operator S0 is actually of very limited practical relevance (because it always should result in a variable containing only zeros), it might happen in programming situations that someone generally codes something like S`n'.`varname', where the local macro n is determined somewhere earlier in the program, and due to whatever calculation this macro might evaluate to zero. In this case, subsequent results would become wrong.
Edit: In Stata's help file for tsvarlist, Remark 7 states
This is meaningful for the operators L#, F#, and D#, but in my view not for S#. In any case, this is also not what is happening when using the operator S0.
I detected a strange bug with the the seasonal differencing time-series operator. When I generate a new variable as
Code:
gen newvar = S0.oldvar
See the following example:
Code:
. webuse gxmpl1, clear . gen gnp_s0 = S0.gnp (1 missing value generated) . gen gnp_s1 = S1.gnp (1 missing value generated) . summarize gnp S0.gnp S1.gnp gnp_s0 gnp_s1 Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- gnp | --. | 8 6955.237 885.67 5837.9 8337.3 S1. | 8 0 0 0 0 S1. | 7 357.0571 94.32038 188.3999 485.3999 | gnp_s0 | 7 357.0571 94.32038 188.3999 485.3999 gnp_s1 | 7 357.0571 94.32038 188.3999 485.3999 . display "`: tsnorm s0'" S . display "`: tsnorm s1'" S . display "`: tsnorm s2'" S2
I could confirm the problem with Stata versions 10, 11, 12, and 13, but I do not yet have access to Stata 14.
While the operator S0 is actually of very limited practical relevance (because it always should result in a variable containing only zeros), it might happen in programming situations that someone generally codes something like S`n'.`varname', where the local macro n is determined somewhere earlier in the program, and due to whatever calculation this macro might evaluate to zero. In this case, subsequent results would become wrong.
Edit: In Stata's help file for tsvarlist, Remark 7 states
In operator#, making # zero returns the variable itself.
Comment