Migration
SAS to Databricks migration: converting DATA steps, PROCs and macros
How to migrate SAS analytics and ETL to Databricks: inventory programs, convert DATA steps and PROC SQL to Spark SQL and PySpark, replace PROCs, macros and formats, revalidate models and retire SAS licences.

Hemant Walchale
· 2 min read
SAS has powered analytics, risk models and reporting in banks, insurers, pharmaceutical companies and government for decades. Licence costs and the shift of talent to Python lead many organizations to move SAS workloads to Databricks. It is a different kind of migration from a warehouse move: much of the value sits in analytical logic and models that must give the same answers.
This is the approach we recommend.
1. Inventory programs and their purpose
Collect SAS programs, Enterprise Guide projects, DI Studio jobs, macro libraries, format catalogues, scheduled jobs (cron, LSF or another scheduler), datasets and their consumers. Classify each program: data preparation (ETL), reporting, or statistical modelling. They migrate differently, and usage logs usually show a large share that can be retired.
2. Map SAS constructs to Databricks
| SAS | On Databricks |
|---|---|
PROC SQL |
Spark SQL |
| DATA step (filter, derive, merge) | Spark SQL or PySpark DataFrame code |
BY groups, FIRST. and LAST., RETAIN, LAG |
Window functions (ROW_NUMBER, LAG, running totals) |
Arrays and DO loops |
Column expressions, transform, or Python |
PROC SORT, PROC TRANSPOSE |
ORDER BY where needed, PIVOT and UNPIVOT |
PROC MEANS, PROC FREQ, PROC SUMMARY |
GROUP BY aggregates, or pandas API on Spark |
PROC REG, PROC LOGISTIC and other modelling PROCs |
Python libraries such as statsmodels and scikit-learn, tracked with MLflow |
| Macros and macro variables | Python functions, notebook and job parameters |
| Formats | Lookup tables or CASE expressions |
SAS datasets (.sas7bdat) |
Delta tables |
| Scheduled SAS jobs | Lakeflow Jobs |
| Reports (ODS, Enterprise Guide outputs) | Databricks SQL dashboards or your BI tool |
3. Migrate ETL first, models second
Data preparation code moves fastest and frees licences early. Models follow, each rebuilt in Python and validated against SAS output on the same data, with tolerances agreed with model owners and, where required, model risk teams.
4. Validate side by side
Run SAS and the new code on the same inputs and compare outputs: row counts, totals and row-level values for data steps; coefficients, scores and performance metrics for models. Typical differences come from missing-value handling (SAS treats missing numerics as smaller than any number in comparisons), rounding, date origins and sort stability.
5. Retire licences by product
Plan waves around SAS licence renewal dates and retire products (Base, STAT, Enterprise Guide, DI Studio) as their workloads empty.
The short version
Inventory and classify programs, retire what’s unused, convert PROC SQL and DATA steps to Spark, replace macros and formats, rebuild models in Python with documented validation, compare outputs side by side and retire SAS products as workloads move.
Browse all migration guides, see Oracle to Databricks for a related warehouse move, or estimate effort with the migration estimator.
Not sure where your own platform stands? Take the free 3-minute data platform scorecard, or see how we work on Databricks. Unfamiliar terms are explained in the data engineering glossary.