To estimate the causal effect of surgery vs chemotherapy on survival in patients with T1-3NxM0 pancreatic cancer in a rigorous framework addressing selection bias and immortal time bias. We used population-based Danish health-care registries to conduct a cohort study emulating a hypothetical randomized trial to estimate the absolute difference in survival, comparing surgery with chemotherapy. We included pancreatic cancer patients diagnosed during 2008-2021. Exposure was surgery or chemotherapy initiated within a 16-week grace period after diagnosis. At the time of diagnosis, data of each patient were duplicated; one copy was assigned to the surgery protocol, and one copy to the chemotherapy protocol of the hypothetical trial. Copies were censored when the assigned treatment deviated from the observed treatment. To account for informative censoring, uncensored patients were weighted according to confounders. For comparison, we also applied a more conventional analysis using propensity score-based inverse probability weighting. We included 1744 patients with a median age of 68 years: 73.6% underwent surgery, and 18.6% had chemotherapy without surgery; 7.8% received no treatment. The 3-year survival was 39.7% (95% confidence interval [CI] = 36.7% to 42.6%) after surgery and 22.7% (95% CI = 17.7% to 28.4%) after chemotherapy, corresponding to an absolute difference of 17.0% (95% CI = 10.8% to 23.1%). In the conventional survival analysis, this difference was 23.0% (95% CI = 17.0% to 29.0%). Surgery was superior to chemotherapy in achieving long-term survival for pancreatic cancer. The difference comparing surgery and chemotherapy was substantially smaller when using the clone-censor-weight approach than conventional survival analysis.