# ===== Export the NHANES analytic table (842 rows, public data) for the Korea comparison =====
# Paste into a new cell in the same Colab session and run. Saves nhanes_analytic.csv.
cols = ["SEQN", "cycle", "age", "female", "duration", "insulin", "oral_med", "htn", "obese", "smoker", "mi",
        "hba1c", "bmi", "wt", "strata", "psu", "dr_worse", "csme", "ret_worse", "n_grad", "stage3", "stage3_icdr"]
df[[c for c in cols if c in df.columns]].to_csv("nhanes_analytic.csv", index=False)
try:
    from google.colab import files; files.download("nhanes_analytic.csv")
except ImportError:
    print("Saved nhanes_analytic.csv")
