On Fri, 11 Sep 2020, Allin Cottrell wrote:
 On Fri, 11 Sep 2020, Riccardo (Jack) Lucchetti wrote:
> A user wrote me in private, asking me about some oddities on series 
> indexing via strings. I put together a little example:
> 
> <hansl>
> nulldata 4
> xs = normal(2,1)
> setobs 1 2000 --time-series
> 
> # 1: this works
> xs["2000"] = 3
> # 2: this works too
> a = sprintf("\"2000\"")
> xs[@a] = 33
> # 3: this doesn't
> a = "2000"
> xs[a] = 33
> </hansl>
> 
> if assignments 1 and 2 work, one sees no reason why 3 shouldn't work too. 
> Or ami I missing something obvious?
 Well, when indexing into a series gretl expects one of the following:
 * a literal observation-marker string
 * an integer (1-based) observation number
 * an expression which evaluates to an observation number
 That's fairly flexible. But if we get a variable as an index we try to 
 interpret it as a plain integer, which obviously doesn't work for a =
"2000". 
 Note that these work [...] 
Perhaps more to the point, this works:
a = "2000"
xs[obsnum(a)] = 33
where obsnum() has the effect: interpret this as an observation 
label, not a 1-based index.
Allin