Commit d5f29e0b authored by MichelJuillard's avatar MichelJuillard
Browse files

sbvar: made option final_year optional is using the entire sample

parent ee9bc3e4
function check_datafile_years_assigned(options_)
function [final_year,final_subperiod]=check_datafile_years_assigned(options_)
% function check_datafile_years_assigned(options_)
% check that datafile, initial_year and final_year were assigned
%
......@@ -25,12 +25,18 @@ function check_datafile_years_assigned(options_)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
final_year = [];
final_subperiod = [];
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');
n = size(options_.data,1);
freq = options_.ms.freq;
final_subperiod = mod(options_.ms.initial_subperiod+n-2,freq)+1;
final_year = options_.ms.initial_year + floor((n-1)/freq);
end
if isempty(options_.datafile)
......
......@@ -33,8 +33,12 @@ 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);
[final_year,final_subperiod] = check_datafile_years_assigned(options);
if ~isempty(final_year)
options.ms.final_year = final_year;
opions.ms.final_subperiod = final_subperiod;
end
if options.forecast == 0
options.forecast = 4;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment