diff --git a/doc/dynare.texi b/doc/dynare.texi
index 924eb95d970272d38064918655f5bc64233c8163..be59f714448110d07b8c7cdafb295c02d15073cb 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -10767,7 +10767,7 @@ and to abort. The argument must evaluate to a string.
 @deffnx {Macro directive} @@#echomacrovars(save) @var{MACRO_EXPRESSION}
 Asks the preprocessor to display the value of all macro variables up until this
 point. If the @code{save} option is passed, the values of the macro variables
-are saved to @code{options_.macrovars}.
+are saved to @code{options_.macrovars_line_<<line_number>>}.
 @end deffn
 
 @node Typical usages
diff --git a/preprocessor/macro/MacroDriver.cc b/preprocessor/macro/MacroDriver.cc
index 1633b8132e1ee91a2636bf1c61cbf8a6563e9857..bd15152b366c5830305a6035d95308bb256940ae 100644
--- a/preprocessor/macro/MacroDriver.cc
+++ b/preprocessor/macro/MacroDriver.cc
@@ -229,6 +229,6 @@ MacroDriver::printvars(const Macro::parser::location_type &l, const bool tostdou
 
   for (map<string, const MacroValue *>::const_iterator it = env.begin();
        it != env.end(); it++)
-    intomfile<< "options_.macrovars." << it->first << " = " << it->second->print() << ";" << endl;
+    intomfile<< "options_.macrovars_line_" << l.begin.line << "." << it->first << " = " << it->second->print() << ";" << endl;
   return intomfile.str();
 }