diff --git a/src/Shocks.cc b/src/Shocks.cc
index 6a80a84ce262e9752bf2f5d6441c2575f0f3848f..3c33baf2ec06e9af90d475e0cbc7881502142f9e 100644
--- a/src/Shocks.cc
+++ b/src/Shocks.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2003-2024 Dynare Team
+ * Copyright © 2003-2025 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -881,12 +881,9 @@ ConditionalForecastPathsStatement::writeOutput(ostream& output,
       for (const auto& [period_range, value] : elems)
         {
           auto [period1, period2] = get<pair<int, int>>(period_range);
-          for (int j = period1; j <= period2; j++)
-            {
-              output << "constrained_paths_(" << k << "," << j << ")=";
-              value->writeOutput(output);
-              output << ";" << endl;
-            }
+          output << "constrained_paths_(" << k << "," << period1 << ":" << period2 << ")=";
+          value->writeOutput(output);
+          output << ";" << endl;
         }
       k++;
     }