diff --git a/matlab/ms-sbvar/identification/exclusions.m b/matlab/ms-sbvar/identification/exclusions.m
index a2447b1ba157060e599b33eb58130441288014a5..5e7d3ef5c040da64ece9eb203f2e32bedd2b2fb7 100644
--- a/matlab/ms-sbvar/identification/exclusions.m
+++ b/matlab/ms-sbvar/identification/exclusions.m
@@ -1,4 +1,4 @@
-function [Ui,Vi,n0,np,ixmC0Pres,Qi] = exclusions(nvar,nexo,options_ms)
+function [Ui,Vi,n0,np,ixmC0Pres,Qi,Ri] = exclusions(nvar,nexo,options_ms)
 % function [Ui,Vi,n0,np,ixmC0Pres] = exclusions(nvar,nexo,options_ms)
 %
 % INPUTS
diff --git a/matlab/ms-sbvar/sbvar_global_identification_check.m b/matlab/ms-sbvar/svar_global_identification_check.m
similarity index 65%
rename from matlab/ms-sbvar/sbvar_global_identification_check.m
rename to matlab/ms-sbvar/svar_global_identification_check.m
index 642220f54fb4f9e90436eba9bbfd9bc8dddcdd88..549d5c7fd40150a46bd27d185de9662586c588cf 100644
--- a/matlab/ms-sbvar/sbvar_global_identification_check.m
+++ b/matlab/ms-sbvar/svar_global_identification_check.m
@@ -1,5 +1,6 @@
-function indent = sbvar_global_identification_check(options_)
-% function sbvar_global_identification_check(options_.ms)
+function indent = svar_global_identification_check(options_)
+% function svar_global_identification_check(options_.ms) checks
+% identification of s structural VAR
 %
 % INPUTS
 %    options_ms:    (struct)    options
@@ -9,6 +10,11 @@ function indent = sbvar_global_identification_check(options_)
 %
 % SPECIAL REQUIREMENTS
 %    none
+%
+% REFERENCES
+%   J. Rubio Ramirez, D. Waggoner, T. Zha (2010) "Structural Vector
+%   Autoregressions: Theory of Identification and Algorithms for
+%   Inference" in Review of Economic Studies, 77, 665-696.
 
 % Copyright (C) 2015 Dynare Team
 %
@@ -42,28 +48,34 @@ end
 nvar = length(options_.varobs);   % number of endogenous variables
 nexo = 1;
    
-[Uiconst,Viconst,n0,np,ixmC0Pres,Qi] = exclusions(nvar,nexo,options_.ms );
+[Uiconst,Viconst,n0,np,ixmC0Pres,Qi,Ri] = exclusions(nvar,nexo,options_.ms );
 
 % order column constraints by rank
-Qranks = zeros(nvar,2);
+QQranks = zeros(nvar,2);
 for j=1:nvar
-    Qranks(j,:) = [j,rank(Qi{j})];
+    n = nvar*(options_.ms.nlags+1);
+    QQi{j} = zeros(n,n);
+    QQi{j}(1:nvar,1:nvar) = Qi{j};
+    QQi{j}(nvar+1:end,nvar+1:end) = Ri{j}(1:end-1,1:end-1);
+    QQranks(j,:) = [j,rank(QQi{j})];
 end
-Qranks = sortrows(Qranks,-2);
+QQranks = sortrows(QQranks,-2);
 
 ident = true;
 
 for j=1:nvar
-    i = Qranks(j,1);
+    i = QQranks(j,1);
     for k=1:1
-        M = [Qi{i}*rand(size(Qi{i},1),nvar);[eye(j) zeros(j,nvar- ...
-                                                          j)]];
-        disp([j,k,rank(M)])
+        M = [QQi{i}*rand(size(QQi{i},1),nvar);[eye(j) ...
+                            zeros(j,nvar-j)]];
         if rank(M) < nvar
-            ident = false
+            ident = false;
             break
         end
     end
+    if ~ident
+        break
+    end
 end
 
 if ~options_.noprint
diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc
index 28de2ee551da140691e3d1d4a307dae0a75a0cf0..eaeebf2bc27bde15f83b0a3b6af732edc0dd86ce 100644
--- a/preprocessor/ComputingTasks.cc
+++ b/preprocessor/ComputingTasks.cc
@@ -1627,6 +1627,8 @@ SvarIdentificationStatement::getMaxLag() const
 void
 SvarIdentificationStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
 {
+  // no equations OK with Svar Identification
+  mod_file_struct.bvar_present = true;
   if (!mod_file_struct.svar_identification_present)
     mod_file_struct.svar_identification_present = true;
   else
@@ -1704,6 +1706,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
           it->value->writeOutput(output);
           output << ";" << endl;
         }
+      output << "options_.ms.nlags = " << r << ";" << endl;
     }
 }
 
@@ -2010,6 +2013,16 @@ SvarStatement::writeOutput(ostream &output, const string &basename, bool minimal
     output << "'ALL';" << endl;
 }
 
+SvarGlobalIdentificationCheckStatement::SvarGlobalIdentificationCheckStatement(void)
+{
+}
+
+void
+SvarGlobalIdentificationCheckStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
+{
+  output << "svar_global_identification_check(options_);" << std::endl;
+}
+
 SetTimeStatement::SetTimeStatement(const OptionsList &options_list_arg) :
   options_list(options_list_arg)
 {
diff --git a/preprocessor/ComputingTasks.hh b/preprocessor/ComputingTasks.hh
index 7e6d863bebaccccf242a53a42392efab2d1ffcc9..111f565fd6087cb1eb2af39766e97b84717e567c 100644
--- a/preprocessor/ComputingTasks.hh
+++ b/preprocessor/ComputingTasks.hh
@@ -640,6 +640,13 @@ public:
   virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
 };
 
+class SvarGlobalIdentificationCheckStatement : public Statement
+{
+public:
+  SvarGlobalIdentificationCheckStatement();
+  virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
+};
+
 class SetTimeStatement : public Statement
 {
 private:
diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy
index 392d3d3efe60a54ccc2b9b23a191f6a3df0c1343..73dfb18169aea04215122585abe46c472f879876 100644
--- a/preprocessor/DynareBison.yy
+++ b/preprocessor/DynareBison.yy
@@ -157,7 +157,7 @@ class ParsingDriver;
 %token MS_ESTIMATION MS_SIMULATION MS_COMPUTE_MDD MS_COMPUTE_PROBABILITIES MS_FORECAST
 %token SVAR_IDENTIFICATION EQUATION EXCLUSION LAG UPPER_CHOLESKY LOWER_CHOLESKY MONTHLY QUARTERLY
 %token MARKOV_SWITCHING CHAIN DURATION NUMBER_OF_REGIMES NUMBER_OF_LAGS
-%token SVAR COEFF COEFFICIENTS VARIANCES CONSTANTS EQUATIONS
+%token SVAR SVAR_GLOBAL_IDENTIFICATION_CHECK COEFF COEFFICIENTS VARIANCES CONSTANTS EQUATIONS
 %token EXTERNAL_FUNCTION EXT_FUNC_NAME EXT_FUNC_NARGS FIRST_DERIV_PROVIDED SECOND_DERIV_PROVIDED
 %token SELECTED_VARIABLES_ONLY COVA_COMPUTE SIMULATION_FILE_TAG FILE_TAG
 %token NO_ERROR_BANDS ERROR_BAND_PERCENTILES SHOCKS_PER_PARAMETER NO_CREATE_INIT
@@ -258,6 +258,7 @@ statement : parameters
           | conditional_forecast_paths
           | plot_conditional_forecast
           | svar_identification
+          | svar_global_identification_check
           | markov_switching
           | svar
           | external_function
@@ -850,6 +851,10 @@ restriction_elem_expression : COEFF '(' symbol COMMA INT_NUMBER ')'
                                  { driver.add_positive_restriction_element($1,$5,$7);}
                             ;
 
+svar_global_identification_check: SVAR_GLOBAL_IDENTIFICATION_CHECK ';'
+                                  { driver.add_svar_global_identification_check(); }
+                                ;
+				
 markov_switching : MARKOV_SWITCHING '(' ms_options_list ')' ';'
                    { driver.markov_switching(); }
                  ;
diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll
index ce022df74363857411b69d4ed0d970c9ff54df84..f380e502101919fba499551d68eb126a792802eb 100644
--- a/preprocessor/DynareFlex.ll
+++ b/preprocessor/DynareFlex.ll
@@ -163,6 +163,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 
 <INITIAL>markov_switching {BEGIN DYNARE_STATEMENT; return token::MARKOV_SWITCHING;}
 <INITIAL>svar {BEGIN DYNARE_STATEMENT; return token::SVAR;}
+<INITIAL>svar_global_identification_check {BEGIN DYNARE_STATEMENT; return token::SVAR_GLOBAL_IDENTIFICATION_CHECK;}
 <INITIAL>external_function {BEGIN DYNARE_STATEMENT; return token::EXTERNAL_FUNCTION;}
  /* End of a Dynare statement */
 <INITIAL>calib_smoother { BEGIN DYNARE_STATEMENT; return token::CALIB_SMOOTHER; } 
diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc
index f2621fcf94a5a12abc9d1f111443bc9869962e83..26d0dc6162de649f6fcc7a7d8c615a34814bc5f4 100644
--- a/preprocessor/ParsingDriver.cc
+++ b/preprocessor/ParsingDriver.cc
@@ -1013,6 +1013,12 @@ ParsingDriver::add_constants_exclusion()
   svar_constants_exclusion = true;
 }
 
+void
+ParsingDriver::add_svar_global_identification_check()
+{
+  mod_file->addStatement(new SvarGlobalIdentificationCheckStatement);
+}
+
 void
 ParsingDriver::do_sigma_e()
 {
diff --git a/preprocessor/ParsingDriver.hh b/preprocessor/ParsingDriver.hh
index 7ad6aaf48fa7b64ad07ae7e43d937bc0e206e932..cd1a782d47a37e2a23926eeb8d06395e7f8f498b 100644
--- a/preprocessor/ParsingDriver.hh
+++ b/preprocessor/ParsingDriver.hh
@@ -485,6 +485,8 @@ public:
   void add_upper_cholesky();
   //! Svar_Identification Statement: restriction of form lower cholesky
   void add_lower_cholesky();
+  //! Svar_Global_Identification_Check Statement
+  void add_svar_global_identification_check();
   //! Forecast Statement
   void forecast();
   void set_trends();
diff --git a/tests/ms-sbvar/rwz2010.mod b/tests/ms-sbvar/rwz2010.mod
new file mode 100644
index 0000000000000000000000000000000000000000..31754151f04d6654961a7a9b71df07e3caddfc68
--- /dev/null
+++ b/tests/ms-sbvar/rwz2010.mod
@@ -0,0 +1,20 @@
+var Pie Y R;
+
+varobs Pie Y R;
+
+svar_identification;
+exclusion lag 0;
+equation 1, R;
+exclusion lag 1;
+equation 1, Y, R;
+equation 2, Pie, R;
+equation 3, Pie, Y;
+exclusion lag 2;
+equation 1, Y, R;
+equation 2, Pie, R;
+equation 3, Pie, Y, R;
+restriction equation 1, coeff(R,0) - coeff(Pie,0) = 0;
+end;
+
+svar_global_identification_check;
+
diff --git a/tests/ms-sbvar/test_global_identification_OK.mod b/tests/ms-sbvar/test_global_identification_1.mod
similarity index 100%
rename from tests/ms-sbvar/test_global_identification_OK.mod
rename to tests/ms-sbvar/test_global_identification_1.mod
diff --git a/tests/ms-sbvar/test_global_identification_FAILURE.mod b/tests/ms-sbvar/test_global_identification_2.mod
similarity index 61%
rename from tests/ms-sbvar/test_global_identification_FAILURE.mod
rename to tests/ms-sbvar/test_global_identification_2.mod
index 8ff9cfdddc849b27e42e54847977d271adec1421..d9c277eba12a0569526ece9bf6d1d42a690c2d06 100644
--- a/tests/ms-sbvar/test_global_identification_FAILURE.mod
+++ b/tests/ms-sbvar/test_global_identification_2.mod
@@ -10,7 +10,5 @@ exclusion lag 1;
 equation 2, Y;
 end;
 
-sbvar_global_identification_check(options_);
-
-sbvar(datafile = data,freq=4,initial_year=1959,final_year=2005,nlags=4);
+svar_global_identification_check;