diff --git a/src/@x13/print.m b/src/@x13/print.m
index 7d5f7bddea300d5a4f87109784b5000903a39e99..a2aff33721003fd0b43b4dd2eca9c12021b59a00 100644
--- a/src/@x13/print.m
+++ b/src/@x13/print.m
@@ -24,7 +24,13 @@ if nargin<2 || isempty(basename)
 end
 
 fid = fopen(sprintf('%s.spc', basename), 'w');
-fprintf(fid, '# File created on %s by Dynare.\n\n', datetime());
+
+% Print creation date
+if ~isoctave() && ~verLessThan('matlab','9.0')
+    fprintf(fid, '# File created on %s by Dynare.\n\n', datetime());
+else
+    fprintf(fid, '# File created on %s by Dynare.\n\n', datestr(now));
+end
 
 % Write SERIES block
 fprintf(fid, 'series {\n');
@@ -35,135 +41,174 @@ fprintf(fid, ' data = %s', sprintf(data2txt(o.y.data)));
 fprintf(fid, '}\n\n');
 
 % Write TRANSFORM block
-if ~all(cellfun(@isempty, struct2cell(o.transform)))
-    optionnames = fieldnames(o.transform);
-    fprintf(fid, 'transform {\n');
-    for i=1:length(optionnames)
-        if ~isempty(o.transform.(optionnames{i}))
-            printoption(fid, optionnames{i}, o.transform.(optionnames{i}));
+if ismember('transform', o.commands)
+    fprintf(fid, 'transform {');
+    if ~all(cellfun(@isempty, struct2cell(o.transform)))
+        fprintf(fid, '\n');
+        optionnames = fieldnames(o.transform);
+        for i=1:length(optionnames)
+            if ~isempty(o.transform.(optionnames{i}))
+                printoption(fid, optionnames{i}, o.transform.(optionnames{i}));
+            end
         end
     end
     fprintf(fid, '}\n\n');
 end
 
 % Write REGRESSION block
-if ~all(cellfun(@isempty, struct2cell(o.regression)))
-    optionnames = fieldnames(o.regression);
-    fprintf(fid, 'regression {\n');
-    for i=1:length(optionnames)
-        if ~isempty(o.regression.(optionnames{i}))
-            if isequal(optionnames{i}, 'user') % Write needed data to a file.
-                % Determine the set of needed data
-                conditionningvariables = strsplit(o.regression.user, {',' , '(' , ')' , ' '});
-                conditionningvariables = conditionningvariables(~cellfun(@isempty,conditionningvariables));
-                % Check that these data are available.
-                for i=1:length(conditionningvariables)
-                    if ~ismember(conditionningvariables{i}, o.x.name)
-                        fclose(fid);
-                        error('x13:regression: Variable %s is unkonwn', conditionningvariables{i})
+if ismember('regression', o.commands)
+    fprintf(fid, 'regression {');
+    if ~all(cellfun(@isempty, struct2cell(o.regression)))
+        optionnames = fieldnames(o.regression);
+        fprintf(fid, '\n');
+        for i=1:length(optionnames)
+            if ~isempty(o.regression.(optionnames{i}))
+                if isequal(optionnames{i}, 'user') % Write needed data to a file.
+                                                   % Determine the set of needed data
+                    conditionningvariables = strsplit(o.regression.user, {',' , '(' , ')' , ' '});
+                    conditionningvariables = conditionningvariables(~cellfun(@isempty,conditionningvariables));
+                    % Check that these data are available.
+                    for i=1:length(conditionningvariables)
+                        if ~ismember(conditionningvariables{i}, o.x.name)
+                            fclose(fid);
+                            error('x13:regression: Variable %s is unkonwn', conditionningvariables{i})
+                        end
                     end
-                end
-                % Select the data.
-                if length(conditionningvariables)<vobs(o.x)
-                    x = o.x{conditionningvariables{:}};
-                else
-                    x= o.x;
-                end
-                % Print user statement.
-                fprintf(fid, ' user = %s\n', o.regression.user);
-                % Print data statement.
-                fprintf(fid, ' data = %s\n', sprintf(data2txt(x.data)));
-            elseif isequal(optionnames{i}, 'start')
-                if ischar(o.regression.start)
-                    if isdate(o.regression.start)
-                        PERIOD = dates(o.regression.start);
+                    % Select the data.
+                    if length(conditionningvariables)<vobs(o.x)
+                        x = o.x{conditionningvariables{:}};
+                    else
+                        x= o.x;
+                    end
+                    % Print user statement.
+                    fprintf(fid, ' user = %s\n', o.regression.user);
+                    % Print data statement.
+                    fprintf(fid, ' data = %s\n', sprintf(data2txt(x.data)));
+                elseif isequal(optionnames{i}, 'start')
+                    if ischar(o.regression.start)
+                        if isdate(o.regression.start)
+                            PERIOD = dates(o.regression.start);
+                        else
+                            error('x13:regression: Option start cannot be interpreted as a date!')
+                        end
+                    elseif isdates(o.regression.start)
+                        PERIOD = o.regression.start;
                     else
                         error('x13:regression: Option start cannot be interpreted as a date!')
                     end
-                elseif isdates(o.regression.start)
-                    PERIOD = o.regression.start;
+                    printstart(fid, PERIOD);
                 else
-                    error('x13:regression: Option start cannot be interpreted as a date!')
+                    printoption(fid, optionnames{i}, o.regression.(optionnames{i}));
                 end
-                printstart(fid, PERIOD);
-            else
-                printoption(fid, optionnames{i}, o.regression.(optionnames{i}));
             end
         end
-    end
-    if isempty(o.regression.start)
-        fprintf(fid, ' start = %i.%i\n', o.x.init.year, o.x.init.subperiod);
+        if isempty(o.regression.start)
+            fprintf(fid, ' start = %i.%i\n', o.x.init.year, o.x.init.subperiod);
+        end
     end
     fprintf(fid, '}\n\n');
 end
 
 % Write ARIMA block
-if ~all(cellfun(@isempty, struct2cell(o.arima)))
-    optionnames = fieldnames(o.arima);
-    fprintf(fid, 'arima {\n');
-    for i=1:length(optionnames)
-        if ~isempty(o.arima.(optionnames{i}))
-            printoption(fid, optionnames{i}, o.arima.(optionnames{i}));
+if ismember('arima', o.commands)
+    fprintf(fid, 'arima {');
+    if ~all(cellfun(@isempty, struct2cell(o.arima)))
+        optionnames = fieldnames(o.arima);
+        fprintf(fid, '\n');
+        for i=1:length(optionnames)
+            if ~isempty(o.arima.(optionnames{i}))
+                printoption(fid, optionnames{i}, o.arima.(optionnames{i}));
+            end
+        end
+    end
+    fprintf(fid, '}\n\n');
+end
+
+% Write AUTOMDL block
+if ismember('automdl', o.commands)
+    fprintf(fid, 'automdl {');
+    if ~all(cellfun(@isempty, struct2cell(o.automdl)))
+        optionnames = fieldnames(o.automdl);
+        fprintf(fid, '\n');
+        for i=1:length(optionnames)
+            if ~isempty(o.automdl.(optionnames{i}))
+                printoption(fid, optionnames{i}, o.automdl.(optionnames{i}));
+            end
         end
     end
     fprintf(fid, '}\n\n');
 end
 
 % Write OUTLIER block
-if ~all(cellfun(@isempty, struct2cell(o.outlier)))
-    optionnames = fieldnames(o.outlier);
-    fprintf(fid, 'outlier {\n');
-    for i=1:length(optionnames)
-        if ~isempty(o.outlier.(optionnames{i}))
-            printoption(fid, optionnames{i}, o.outlier.(optionnames{i}));
+if ismember('outlier', o.commands)
+    fprintf(fid, 'outlier {');
+    if ~all(cellfun(@isempty, struct2cell(o.outlier)))
+        optionnames = fieldnames(o.outlier);
+        fprintf(fid, '\n');
+        for i=1:length(optionnames)
+            if ~isempty(o.outlier.(optionnames{i}))
+                printoption(fid, optionnames{i}, o.outlier.(optionnames{i}));
+            end
         end
     end
     fprintf(fid, '}\n\n');
 end
 
 % Write FORECAST block
-if ~all(cellfun(@isempty, struct2cell(o.forecast)))
-    optionnames = fieldnames(o.forecast);
-    fprintf(fid, 'forecast {\n');
-    for i=1:length(optionnames)
-        if ~isempty(o.forecast.(optionnames{i}))
-            printoption(fid, optionnames{i}, o.forecast.(optionnames{i}));
+if ismember('forecast', o.commands)
+    fprintf(fid, 'forecast {');
+    if ~all(cellfun(@isempty, struct2cell(o.forecast)))
+        optionnames = fieldnames(o.forecast);
+        fprintf(fid, '\n');
+        for i=1:length(optionnames)
+            if ~isempty(o.forecast.(optionnames{i}))
+                printoption(fid, optionnames{i}, o.forecast.(optionnames{i}));
+            end
         end
     end
     fprintf(fid, '}\n\n');
 end
 
 % Write ESTIMATE block
-if ~all(cellfun(@isempty, struct2cell(o.estimate)))
-    optionnames = fieldnames(o.estimate);
-    fprintf(fid, 'estimate {\n');
-    for i=1:length(optionnames)
-        if ~isempty(o.estimate.(optionnames{i}))
-            printoption(fid, optionnames{i}, o.estimate.(optionnames{i}));
+if ismember('estimate', o.commands)
+    fprintf(fid, 'estimate {');
+    if ~all(cellfun(@isempty, struct2cell(o.estimate)))
+        optionnames = fieldnames(o.estimate);
+        fprintf(fid, '\n');
+        for i=1:length(optionnames)
+            if ~isempty(o.estimate.(optionnames{i}))
+                printoption(fid, optionnames{i}, o.estimate.(optionnames{i}));
+            end
         end
     end
     fprintf(fid, '}\n\n');
 end
 
 % Write CHECK block
-if ~all(cellfun(@isempty, struct2cell(o.check)))
-    optionnames = fieldnames(o.check);
-    fprintf(fid, 'check {\n');
-    for i=1:length(optionnames)
-        if ~isempty(o.check.(optionnames{i}))
-            printoption(fid, optionnames{i}, o.check.(optionnames{i}));
+if ismember('check', o.commands)
+    fprintf(fid, 'check {');
+    if ~all(cellfun(@isempty, struct2cell(o.check)))
+        optionnames = fieldnames(o.check);
+        fprintf(fid, '\n');
+        for i=1:length(optionnames)
+            if ~isempty(o.check.(optionnames{i}))
+                printoption(fid, optionnames{i}, o.check.(optionnames{i}));
+            end
         end
     end
     fprintf(fid, '}\n\n');
 end
 
 % Write X11 block
-if ~all(cellfun(@isempty, struct2cell(o.x11)))
-    optionnames = fieldnames(o.x11);
-    fprintf(fid, 'x11 {\n');
-    for i=1:length(optionnames)
-        if ~isempty(o.x11.(optionnames{i}))
-            printoption(fid, optionnames{i}, o.x11.(optionnames{i}));
+if ismember('x11', o.commands)
+    fprintf(fid, 'x11 {');
+    if ~all(cellfun(@isempty, struct2cell(o.x11)))
+        optionnames = fieldnames(o.x11);
+        fprintf(fid, '\n');
+        for i=1:length(optionnames)
+            if ~isempty(o.x11.(optionnames{i}))
+                printoption(fid, optionnames{i}, o.x11.(optionnames{i}));
+            end
         end
     end
     fprintf(fid, '}\n\n');
diff --git a/src/@x13/subsref.m b/src/@x13/subsref.m
index 40f4ee397213ec7b92d949e8c4cca81c7ec2170f..e26223940b0d5fb14964e1caccba056c33fca0c2 100644
--- a/src/@x13/subsref.m
+++ b/src/@x13/subsref.m
@@ -22,12 +22,26 @@ function o = subsref(o, S) % --*-- Unitary tests --*--
 switch S(1).type
   case '.'
     switch S(1).subs
-      case {'arima','regression','transform','outlier', 'forecast', 'check', 'x11', 'estimate'}
+      case {'arima','automdl','regression','transform','outlier', 'forecast', 'check', 'x11', 'estimate'}
         if isequal(length(S), 1)
             % Just print the member.
             disp(o.(S(1).subs))
         else
             if isequal(S(2).type,'()')
+                if ~ismember(S(1).subs, o.commands)
+                    switch S(1).subs
+                      case 'arima'
+                        if ismember('automdl', o.commands)
+                            error('x13:arima: ARIMA command is not compatible with AUTOMDL command!')
+                        end
+                      case 'automdl'
+                        if ismember('arima', o.commands)
+                            error('x13:automdl: AUTOMDL command is not compatible with ARIMA command!')
+                        end
+                      otherwise
+                    end
+                    o.commands(end+1) = {S(1).subs};
+                end
                 if isempty(S(2).subs)
                     % Reset the member to its default (empty).
                     o.(S(1).subs) = setdefaultmember(S(1).subs);
diff --git a/src/@x13/x13.m b/src/@x13/x13.m
index 06deeee42bad0dd4a6bddcba65a0200e3fe88c85..40fedeac04b37a7c5e86b238ef4cc5e4af90498a 100644
--- a/src/@x13/x13.m
+++ b/src/@x13/x13.m
@@ -21,6 +21,7 @@ classdef x13<handle % --*-- Unitary tests --*--
         y          = [];         % dseries object with a single variable.
         x          = [];         % dseries object with an arbitrary number of variables (to be used in the REGRESSION block).
         arima      = [];         % ARIMA model.
+        automdl    = [];         % ARIMA model selection.
         regression = [];         % Regression model.
         estimate   = [];         % Estimation options.
         transform  = [];         % Transform command  applied to y.
@@ -29,6 +30,7 @@ classdef x13<handle % --*-- Unitary tests --*--
         check      = [];         % Check command.
         x11        = [];         % X11 cmmand
         results    = [];         % Estimation results
+        commands   = {};         % List of commands.
     end
 
     methods
@@ -44,6 +46,7 @@ classdef x13<handle % --*-- Unitary tests --*--
                 o.y = dseries();
                 o.x = dseries();
                 o.arima = setdefaultmember('arima');
+                o.automdl = setdefaultmember('automdl');
                 o.regression = setdefaultmember('regression');
                 o.estimate = setdefaultmember('estimate');
                 o.transform = setdefaultmember('transform');
@@ -52,6 +55,7 @@ classdef x13<handle % --*-- Unitary tests --*--
                 o.check = setdefaultmember('check');
                 o.x11 = setdefaultmember('x11');
                 o.results = struct();
+                o.commands = {};
                 return
             end
             if isdseries(y)
@@ -72,6 +76,7 @@ classdef x13<handle % --*-- Unitary tests --*--
             end
             % Initialize other members (they are empty initially and must be set by calling methods)
             o.arima = setdefaultmember('arima');
+            o.automdl = setdefaultmember('automdl');
             o.regression = setdefaultmember('regression');
             o.estimate = setdefaultmember('estimate');
             o.transform = setdefaultmember('transform');
@@ -80,6 +85,7 @@ classdef x13<handle % --*-- Unitary tests --*--
             o.check = setdefaultmember('check');
             o.x11 = setdefaultmember('x11');
             o.results = struct();
+            o.commands = {};
         end
     end
 end
\ No newline at end of file
diff --git a/src/utilities/x13/isoption.m b/src/utilities/x13/isoption.m
index 6d36cad5557d4ce549a5493917e5a9b179d2e19b..588f76b1c1c743fd37333eb60c2e7019d5c21982 100644
--- a/src/utilities/x13/isoption.m
+++ b/src/utilities/x13/isoption.m
@@ -18,6 +18,10 @@ function b = isoption(command, option)
 switch command
   case 'arima'
     b = ismember(option, {'ar', 'ma', 'model', 'print', 'save', 'title'});
+  case 'automdl'
+    b = ismember(option, {'acceptdefault', 'checkmu', 'diff', 'ljungboxlimit', 'maxdiff', 'maxorder', ...
+                        'mixed', 'print', 'savelog', 'armalimit', 'balanced', 'exactdiff', 'fcstlim', ...
+                        'hrinitial', 'reducecv', 'rejectfcst', 'urfinal'});
   case 'regression'
     b = ismember(option, {'aicdiff', 'aictest', 'chi2test', 'chi2testcv', ...
                'print', 'save', 'pvaictest', 'savelog', 'start', ...
@@ -40,7 +44,7 @@ switch command
     b = ismember(option, {'appendbcst', 'appendfcst', 'final', 'mode', 'print', 'save', ...
                'savelog', 'seasonalma', 'sigmalim', 'title', 'trendma', 'type', ...
                'calendarsigma', 'centerseasonal', 'keepholiday', 'print1stpass', ...
-               'sfshort', 'sigmavec', 'trendic', 'true7term'});
+               'sfshort', 'sigmavec', 'trendic', 'true7term', 'excludefcst'});
   otherwise
     error('x13:isoption: Unknown block!')
 end
diff --git a/src/utilities/x13/setdefaultmember.m b/src/utilities/x13/setdefaultmember.m
index d433c8673672cbc5b5f2899c576d68955b47a2dd..0556012a42bbd88a70bc62919ffcf069114ca48c 100644
--- a/src/utilities/x13/setdefaultmember.m
+++ b/src/utilities/x13/setdefaultmember.m
@@ -20,6 +20,10 @@ function s = setdefaultmember(name)
 switch name
   case 'arima'
     s = struct('ar', [], 'ma', [], 'model', [], 'print', [], 'save', [], 'title', []);
+  case 'automdl'
+    s = struct('acceptdefault', [], 'checkmu', [], 'diff', [], 'ljungboxlimit', [], 'maxdiff', [], 'maxorder', [], ...
+                        'mixed', [], 'print', [], 'savelog', [], 'armalimit', [], 'balanced', [], 'exactdiff', [], 'fcstlim', [], ...
+                        'hrinitial', [], 'reducecv', [], 'rejectfcst', [], 'urfinal', []);
   case 'regression'
     s = struct('aicdiff', [], 'aictest', [], 'chi2test', [], 'chi2testcv', [], ...
                'print', [], 'save', [], 'pvaictest', [], 'savelog', [], 'start', [], ...
@@ -44,7 +48,7 @@ switch name
     s = struct('appendbcst', [], 'appendfcst', [], 'final', [], 'mode', [], 'print', [], 'save', [], ...
                'savelog', [], 'seasonalma', [], 'sigmalim', [], 'title', [], 'trendma', [], 'type', [], ...
                'calendarsigma', [], 'centerseasonal', [], 'keepholiday', [], 'print1stpass', [], ...
-               'sfshort', [], 'sigmavec', [], 'trendic', [], 'true7term', []);
+               'sfshort', [], 'sigmavec', [], 'trendic', [], 'true7term', [], 'excludefcst', []);
   otherwise
     error('x13:setdefaultmember: Unknown member!')
 end