in my script stats failed when all the values read are outside the yrange, but it worked when I set yrange to fit all the data points.
stats
yrange