diff --git a/ParsingDriver.cc b/ParsingDriver.cc
index 52f1177ba4e55732400eba5566c309b32328d524..30c4336aa605269ee87c4bd67ce9c5354e13642f 100644
--- a/ParsingDriver.cc
+++ b/ParsingDriver.cc
@@ -546,6 +546,9 @@ ParsingDriver::hist_val(string *name, string *lag, expr_t rhs)
     error("histval: " + *name + " should be an endogenous or exogenous variable");
 
   int ilag = atoi(lag->c_str());
+  if (ilag > 0)
+    error("histval: the lag on " + *name + " should be less than or equal to 0");
+
   pair<int, int> key(symb_id, ilag);
 
   if (mod_file->dynamic_model.minLagForSymbol(symb_id) > ilag - 1)