diff --git a/pandas/io/stata.py b/pandas/io/stata.py
index 053e331925b6f57e3bcc18cdf376de95287a1238..34d95fb59a21ca83a8d69d31c52bfcccf0430398 100644
--- a/pandas/io/stata.py
+++ b/pandas/io/stata.py
@@ -2207,14 +2207,14 @@ def _convert_datetime_to_stata_type(fmt: str) -> np.dtype:
 def _maybe_convert_to_int_keys(convert_dates: dict, varlist: list[Hashable]) -> dict:
     new_dict = {}
     for key, value in convert_dates.items():
-        if not value.startswith("%"):  # make sure proper fmts
+        if not convert_dates[key].startswith("%"):  # make sure proper fmts
             convert_dates[key] = "%" + value
         if key in varlist:
-            new_dict[varlist.index(key)] = value
+            new_dict[varlist.index(key)] = convert_dates[key]
         else:
             if not isinstance(key, int):
                 raise ValueError("convert_dates key must be a column or an integer")
-            new_dict[key] = value
+            new_dict[key] = convert_dates[key]
     return new_dict