Dear All,

I've just found that the following code does not produce an error, while I anticipated it should:

Code:
clear
generate x="abc"
display x[1]
display x[1000]
display x[-1000]
I expected to see here:
Code:
observation numbers out of range
r(198);
Similar to what we are getting after
Code:
replace x=1 in 1000
Observed in Stata 17 (if this matters, but probably all versions of Stata).

Is there any way to restrict this behavior to result in error for when attempts are made to read from outside of the data range?

Thank you, Sergiy