diff --git a/matlab/dynare_identification.m b/matlab/dynare_identification.m
index 7be1af63631cfaaa7435b2282b19081cad05263f..fd9e7a5dec6cbe856f802f9bb5711472cedac612 100644
--- a/matlab/dynare_identification.m
+++ b/matlab/dynare_identification.m
@@ -114,7 +114,7 @@ options_.Schur_vec_tol = 1.e-8;
 options_.nomoments=0;
 options_.analytic_derivation=1;
 
-options_ = set_default_option(options_,'datafile',[]);
+options_ = set_default_option(options_,'datafile','');
 options_.mode_compute = 0;
 options_.plot_priors = 0;
 [dataset_,xparam1, M_, options_, oo_, estim_params_,bayestopt_]=dynare_estimation_init(M_.endo_names,fname_,1, M_, options_, oo_, estim_params_, bayestopt_);
diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m
index 03f164eeba7cb0246b4e70610a2f2a4659405c5c..219e59a30339777855b7b8421b5c0a9aa5762658 100644
--- a/matlab/global_initialization.m
+++ b/matlab/global_initialization.m
@@ -32,7 +32,7 @@ global oo_ M_ options_ estim_params_ bayestopt_ estimation_info ex0_ ys0_  ex_de
 
 estim_params_ = [];
 bayestopt_ = [];
-
+options_.datafile = '';
 options_.console_mode = 0;
 
 options_.verbosity = 1;
diff --git a/matlab/ms-sbvar/check_datafile_years_assigned.m b/matlab/ms-sbvar/check_datafile_years_assigned.m
new file mode 100644
index 0000000000000000000000000000000000000000..18bd51d648155db93cd8b706a61fc02c12e11c0d
--- /dev/null
+++ b/matlab/ms-sbvar/check_datafile_years_assigned.m
@@ -0,0 +1,38 @@
+function check_datafile_years_assigned(options_)
+% function check_datafile_years_assigned(options_)
+% check that datafile, initial_year and final_year were assigned
+%
+% INPUTS
+%    options_:    (struct)    options
+%
+% SPECIAL REQUIREMENTS
+%    none
+
+% Copyright (C) 2012 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+if isempty(options_.ms.initial_year)
+    error('Must set initial_year option');
+end
+
+if isempty(options_.ms.final_year)
+    error('Must set final_year option');
+end
+
+if isempty(options_.datafile)
+    error('Must set datafile option');
+end
diff --git a/matlab/ms-sbvar/initialize_ms_sbvar_options.m b/matlab/ms-sbvar/initialize_ms_sbvar_options.m
index 69da2963ad27f02336867f2dd46a06e1914c0d69..43ea36569d0d4c3992c33373e10c2873825deff1 100644
--- a/matlab/ms-sbvar/initialize_ms_sbvar_options.m
+++ b/matlab/ms-sbvar/initialize_ms_sbvar_options.m
@@ -33,15 +33,11 @@ function options_=initialize_ms_sbvar_options(M_, options_)
 % all mex functions
 options_.ms.file_tag = M_.fname;
 options_.ms.create_init = 1;
-if isfield(options_.ms,'free_param_file')
-    options_.ms = rmfield(options_.ms,'free_param_file');
-end
+options_.ms.mh_file = '';
+options_.ms.free_param_file = '';
 if isfield(options_.ms,'simulation_file_tag')
     options_.ms = rmfield(options_.ms,'simulation_file_tag');
 end
-if isfield(options_.ms,'mh_file')
-    options_.ms = rmfield(options_.ms,'mh_file');
-end
 if isfield(options_.ms,'output_file_tag')
     options_.ms = rmfield(options_.ms,'output_file_tag');
 end
@@ -58,15 +54,8 @@ options_.ms.alpha = 1;
 options_.ms.beta = 1;
 options_.ms.gsig2_lmdm = 50^2;
 options_.ms.specification = 2;
-if isfield(options_.ms,'initial_year')
-    options_.ms = rmfield(options_.ms,'initial_year');
-end
-if isfield(options_.ms,'final_year')
-    options_.ms = rmfield(options_.ms,'final_year');
-end
-if isfield(options_,'datafile')
-    options_ = rmfield(options_,'datafile');
-end
+options_.ms.initial_year = '';
+options_.ms.final_year = '';
 % estimation
 options_.ms.convergence_starting_value = 1e-3;
 options_.ms.convergence_ending_value = 1e-6;
diff --git a/matlab/ms-sbvar/ms_sbvar_setup.m b/matlab/ms-sbvar/ms_sbvar_setup.m
index 183469af1e28ac95e079496efd1ac61d59aab96f..55a2182324e2142caeea328cd39f4bd8ffac63f9 100644
--- a/matlab/ms-sbvar/ms_sbvar_setup.m
+++ b/matlab/ms-sbvar/ms_sbvar_setup.m
@@ -11,7 +11,7 @@ function ms_sbvar_setup(options_)
 % SPECIAL REQUIREMENTS
 %    none
 
-% Copyright (C) 2003-2011 Dynare Team
+% Copyright (C) 2003-2012 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -28,18 +28,7 @@ function ms_sbvar_setup(options_)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-if ~isfield(options_.ms,'initial_year')
-    error('Must set initial_year option');
-end
-
-if ~isfield(options_.ms,'final_year')
-    error('Must set final_year option');
-end
-
-if ~isfield(options_,'datafile')
-    error('Must set datafile option');
-end
-
+check_datafile_years_assigned(options_)
 options_.data = read_variables(options_.datafile, ...
     options_.varobs, [], options_.xls_sheet, options_.xls_range);
 
diff --git a/matlab/ms-sbvar/sbvar.m b/matlab/ms-sbvar/sbvar.m
index 06e00862b6502bb10141dfe4d8f7194771d4d0d3..033051a8cdbd961ceb94b62b5c7d6da0d3e58ccf 100644
--- a/matlab/ms-sbvar/sbvar.m
+++ b/matlab/ms-sbvar/sbvar.m
@@ -33,7 +33,7 @@ function sbvar(M, options)
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
 clean_sbvar_files();
-
+check_datafile_years_assigned(options)
 options.data = read_variables(options.datafile,options.varobs,[],options.xls_sheet,options.xls_range);
 
 if options.forecast == 0
diff --git a/matlab/simul.m b/matlab/simul.m
index a34c0925e5a98f5261dc0b3f93365b68225eaad9..30abba49d61d88fa6b629f0fcb07171d2b9ff5ef 100644
--- a/matlab/simul.m
+++ b/matlab/simul.m
@@ -65,7 +65,7 @@ if options_.periods == 0
 end
 
 if ~ options_.initval_file
-    if ~isfield(options_,'datafile')
+    if isempty(options_.datafile)
         make_ex_;
         make_y_;
     else
diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index 3a3451d5b0862bbce23790004ba042b1fa1c61d2..a33433e03e3d48becfdd60cb9fac122bc3339f37 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -979,12 +979,23 @@ void
 MSSBVAREstimationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
 {
   mod_file_struct.bvar_present = true;
+
+  if (options_list.num_options.find("ms.create_init") == options_list.num_options.end())
+    if (options_list.string_options.find("datafile") == options_list.string_options.end() ||
+        options_list.num_options.find("ms.initial_year") == options_list.num_options.end() ||
+        options_list.num_options.find("ms.final_year") == options_list.num_options.end())
+      {
+        cerr << "ERROR: If you do not pass no_create_init to ms_estimation, "
+             << "you must pass the datafile, initial_year and end_year options." << endl;
+        exit(EXIT_FAILURE);
+      }
 }
 
 void
 MSSBVAREstimationStatement::writeOutput(ostream &output, const string &basename) const
 {
-  output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl;
+  output << "options_ = initialize_ms_sbvar_options(M_, options_);" << endl
+         << "options_.datafile = '';" << endl;
   options_list.writeOutput(output);
   output << "[options_, oo_] = ms_estimation(M_, options_, oo_);" << endl;
 }