
A SAS program written years ago by someone who has since moved on produces the numbers leadership relies on every month. Nobody wants to touch it, the license renewal arrives every year, few people on the current team can read it, and the data it works on already lives in SQL Server, Azure or Snowflake. Sooner or later someone asks whether the processing should live in the database instead. This guide is for the people who have to answer that question.
Short answer: moving the data preparation and reporting logic from SAS into SQL Server is realistic for many organizations, especially when most of the SAS work is joining, cleaning, grouping and producing reporting datasets. SQL Server is a database, not a statistics package, so advanced statistical procedures may stay in SAS or move to R or Python, which SQL Server can run in the database through Machine Learning Services. There is no Microsoft tool that converts SAS programs. Microsoft’s SQL Server Migration Assistant supports Access, Db2, MySQL, Oracle and SAP ASE, but not SAS, so the translation is careful work by people, checked against the SAS output. The risk is rarely in copying the data. It is in keeping the meaning of each calculation: missing values, dates, record order, merges and retained values behave differently.
Series: this is part 4 of our series on moving legacy databases to SQL Server. Part 1 covers Microsoft Access, part 2 covers Excel, part 3 covers Oracle, part 5 covers Sybase / SAP ASE, part 6 covers PostgreSQL, part 7 covers MySQL, part 8 covers Db2, part 9 covers Visual FoxPro, and the complete guide explains why, what it takes and how it is tested.
At a glance
- Why organizations move: recurring license cost, the SAS 9.4 support schedule, fewer people who can read SAS code, data that already sits in SQL Server, Azure or Snowflake, and processing that few people understand.
- When to keep some SAS: advanced statistical procedures, analyses that are validated or regulated and would need re-validation, and SAS-specific tools that have no direct replacement.
- The tool: none that converts SAS. SSMA does not list SAS as a source, so programs are inventoried, translated by people and reconciled to the SAS results.
- What changes the answer: missing values versus NULL, SAS date values, row order, retained values, DATA step merges versus SQL joins, blank text, formats and macros.
- How we start: a free, no-obligation discovery call, then a written assessment and plan you approve before any work begins. No setup fees and no minimum contract.
Why do organizations move away from SAS?
- Recurring cost. SAS is licensed per customer, so we do not quote figures. A renewal that looks large next to the work it supports is the most common starting point, and the useful test is a three-year model built from your own numbers (see below).
- The support schedule. SAS 9.4 maintenance releases move from Standard Support to Limited Support on published dates, and SAS says Limited Support includes no security patches and is not recommended for production-type systems. Staying current means planning upgrades, and some teams use that moment to ask whether SAS is still the right home for the work.
- Skills and handover. The knowledge often sits with one or two programmers. When they leave or retire, nobody can explain why a measure is calculated the way it is, and SQL is a skill most data teams already have.
- Data that lives elsewhere. When source data is in SQL Server, Azure or Snowflake, SAS becomes an extra copy and an extra hop. Moving the processing next to the data removes steps and scheduled transfers.
- Programs that are hard to audit. Long DATA steps, macros that generate other code and undocumented dependencies make it difficult to prove how a number was produced.
- Integration. SQL Server Agent, Power BI, Azure and Microsoft Entra sign-in work naturally with SQL Server, so scheduling, reporting and access control can be managed in one place.
When should you keep some SAS, or not move at all?
An honest assessment sometimes ends with a hybrid design or with “stay.” Here is how we sort the work.
| Topic | Usually a good candidate for SQL Server | Needs a closer look |
|---|---|---|
| Type of work | Data preparation, joins, filtering, grouping, aggregation, scheduled reporting datasets. | Advanced statistical procedures such as regression, survival or mixed models. SQL has no direct equivalent, so these stay in SAS or move to R or Python. |
| Validated or regulated analyses | Reporting logic you can reconcile line by line to approved outputs. | Analyses that cite specific SAS procedures or were formally validated. Re-validation effort belongs in the cost model. |
| SAS tools | Programs and scheduled batch jobs. | Products built around the SAS environment, such as Enterprise Guide projects, Visual Analytics reports or other SAS applications. Each is a separate decision. |
| Where the data lives | Source data already in SQL Server, Azure SQL or Snowflake. | Large SAS datasets used only by SAS, where moving them adds work without removing a dependency. |
| Economics | A recurring cost gap that holds after migration, testing and parallel running. | Small savings, or a license term you cannot exit for years. |
| Pace | A renewal or support date you can plan around, and a phased move. | A forced date with no time to reconcile results. |
Where can SAS and SQL Server give different answers?
These differences turn a “simple conversion” into a project. Each one changes results without raising an error, which is why they are listed first in an assessment.
| Area | In SAS | In SQL Server, and what to do |
|---|---|---|
| Missing values | A missing value is a known value that can be compared and sorted. SAS supports 28 distinct missing values, and SAS sorts them low. | NULL means unknown, so comparisons with it are not true and filters can return fewer rows. SAS’s own documentation lists differences in filtering, MIN, outer joins and sorting. Decide each rule explicitly and test it. |
| Blank text | A blank character value is treated as missing. | A blank is not NULL. Decide whether blanks become NULL or stay empty strings, then apply the rule everywhere. |
| Dates and times | A date is a number of days since January 1, 1960. A datetime is a number of seconds since midnight on that date. A format only changes how it displays. | Use date and datetime2 types and convert on load, for example by adding the day count to January 1, 1960. Check any date arithmetic and reporting periods. |
| Row order | The DATA step reads rows one at a time, in order. | Tables are sets with no inherent order. Any step that depends on order needs an explicit ORDER BY or window ordering, and ties need a rule. |
| BY groups and RETAIN | FIRST. and LAST. flags, retained values and running totals carry information from one row to the next. BY-group processing needs data that is ordered or indexed on the BY variables. | Window functions such as ROW_NUMBER, LAG, LEAD and running SUM with PARTITION BY and ORDER BY, or a recursive query. Test against SAS output. |
| MERGE | A DATA step merge by key steps through the data in order. With repeated key values in more than one input, rows match one to one within the group. | A join returns every combination of matching rows. The same inputs can give different row counts, so define the relationship between the tables first. |
| Numbers | All numeric values are floating point. | Choose int, decimal or float deliberately. Rounding and precision decide whether totals still balance. |
| Text comparison | Character comparisons are case sensitive. | Behavior depends on the collation. Check joins and filters on text keys. |
| Formats and macros | User-defined formats label and group values. Macros generate code. | Lookup tables and CASE logic for formats. Stored procedures, parameters and, where needed, carefully controlled dynamic SQL for macros. |

What replaces what when SAS code becomes T-SQL?
| SAS | Usually becomes in SQL Server | Watch for |
|---|---|---|
| PROC SQL | T-SQL queries and views | Close but not identical. Functions, date handling, NULL logic and implicit conversions differ. |
| DATA step with IF and assignment | SELECT with CASE and computed columns | Row-by-row logic that depends on earlier rows. |
| PROC SORT with NODUPKEY | ROW_NUMBER and keep the first row per key | SAS keeps the first row in sort order, so ties and ordering rules must be defined. |
| FIRST. / LAST. and RETAIN | Window functions, running totals, LAG and LEAD | Order, resets at group boundaries, and missing values. |
| MERGE | INNER, LEFT, RIGHT or FULL OUTER JOIN | Repeated keys and same-named columns. |
| PROC FREQ, MEANS and SUMMARY | GROUP BY and aggregate functions | Missing-value handling and weights. |
| PROC TRANSPOSE | PIVOT and UNPIVOT, or conditional aggregation | Column names that are generated from data. |
| Macros and %INCLUDE | Stored procedures, parameters, SQL Server Agent job steps | Generated code that nobody has read in years. |
| Statistical procedures | R or Python (in the database or outside it), or stay in SAS | Re-validation of statistical results. |
| Reports and output files | Power BI, SSRS or exports from SQL Server | Layout and delivery schedules that users depend on. |
How do you move SAS data and programs into SQL Server?
Programs. There is no SSMA for SAS. Microsoft’s migration assistant lists Access, Db2, MySQL, Oracle and SAP ASE as sources. Conversion tools and AI assistants can draft SQL from simple steps, and PROC SQL is already close to SQL, but anything that depends on order, retained values, BY groups or missing values needs review by someone who understands both languages and a reconciliation to the SAS output.
Data. The usual options each have a trade-off:
- SAS/ACCESS Interface to Microsoft SQL Server lets SAS write tables into SQL Server, with bulk loading options. It needs a licensed SAS product, and it keeps labels and types under your control.
- Delimited files (for example CSV) loaded with BULK INSERT or bcp avoid a SAS dependency, but they drop labels, formats and numeric precision, so those are exported separately.
- SSIS or other tools reading through ODBC or OLE DB generally need a SAS session or server to read SAS datasets, which can mean extra SAS components or licenses. Confirm that before choosing it.
- Python or R can read SAS datasets and write them to SQL Server, which is useful for one-off loads and for comparing results.
Format catalogs, libname definitions, autoexec files, macro libraries and scheduled batch jobs are part of the system too. They are inventoried first because they are where undocumented rules hide.
What are the options for the overall design?
| Route | What moves | Best for | Trade-off |
|---|---|---|---|
| A. Hybrid | Data and preparation move to SQL Server. SAS reads and writes SQL Server for analysis. | Teams that rely on SAS statistics but want one governed data store. | SAS licensing and skills stay. |
| B. SQL Server first | Data preparation, business rules and reporting datasets move to SQL Server. A smaller SAS footprint remains for statistical procedures. | Mostly data processing and reporting, with some statistical work. | Two environments for a while, with a clear boundary between them. |
| C. SQL Server plus R or Python | Processing moves to SQL Server. Statistical work moves to R or Python, run in the database or outside it. | Organizations that want to retire SAS. | Statistical results must be re-validated, and the team needs R or Python skills. |
| D. SAS Viya | SAS code is upgraded within SAS’s own platform. | Programs that depend heavily on SAS procedures. | Not a SQL Server migration. SAS licensing continues, so compare it to a three-year model. |
Our approach follows seven steps:
- Discover: inventory the programs, macros, formats, libraries, scheduled jobs, input sources and outputs. Find out who uses each report and what decisions depend on it.
- Assess: classify each program as a straight data step, an order-dependent step, a statistical procedure or unused. Write down the definitions each measure must keep.
- Architect: choose the route above, the target (SQL Server edition or Azure SQL), the staging and transformation layers, security and scheduling.
- Plan: a three-year cost model, the translation order, a reconciliation plan with approved outputs, the cutover and the rollback criteria.
- Implement: load the data, translate the logic into explicit SQL, build the staging and reporting layers, and schedule the jobs.
- Validate: reconcile populations, dates, exclusions and totals against established SAS outputs, and investigate every difference until it is explained. Run both systems in parallel for the agreed period.
- Support: monitor, document, hand over, and retire the SAS processing once the new results are accepted.
What usually breaks when you move SAS logic to SQL Server?
Most problems are known and fixable, which is why the assessment comes first. These are the ones that show up most often:
- Missing values and NULL in filters, comparisons, MIN and MAX, and outer joins.
- Blank text that SAS treated as missing and SQL Server stores as an empty string.
- Dates that arrive as day counts or second counts and are loaded as plain numbers.
- Row order assumed by the DATA step, such as “first record per person” with no tie rule.
- Retained values that carry a value forward until something resets it.
- Merges that returned one row per key in SAS and return many rows as a join.
- Duplicates removed in SAS by sort order, with no written rule for which copy to keep.
- Formats that hid a value-to-label mapping nobody documented.
- Macros that generate code from parameters and run in a sequence only the original author knew.
- Numeric precision and rounding that move totals by small amounts.
- Performance: row-by-row logic rewritten as set-based queries, with indexes and statistics tuned for the new workload.
What does it look like when SAS logic has to match a cloud data source?
Here is an anonymized example. A research and reporting organization produced recurring analytical datasets and reports from large administrative record systems. Researchers, analysts and managers used them for research, reporting and program improvement. The processing had been built in SAS, and it did more than move data. The SAS programs decided how records were grouped, which events qualified for a measure and how outcomes were calculated over time. Preserving those definitions mattered, because meaningful comparisons across reporting periods depend on them. The organization also had to connect to source data held by an outside data owner in Snowflake Cloud. That required a clear separation between the owner’s source data and the downstream processing that prepared analytical and reporting datasets. Everconnect’s work was to move the SAS-based processing into SQL Server and to integrate the Snowflake source data into that reporting environment.

| Migration challenge | SQL Server and integration approach |
|---|---|
| The SAS programs combined data preparation and analytical rules, so the migration was more than copying tables. | Translate the applicable transformations into SQL-based processing while preserving the meaning of the reporting rules. |
| SAS processing can depend on record order, retained values and intermediate datasets. A direct syntax conversion can change results. | Review the behavior of each processing step and use explicit SQL logic for ordering, grouping and calculations across related records. |
| The analysis follows events over time. Incorrect sequencing or duplicate handling can change the population in a report. | Define record relationships, event ordering and duplicate-handling rules explicitly in the SQL Server processing model. |
| Historical comparisons depend on consistent definitions across reporting periods. | Reconcile migrated calculations against established SAS outputs, investigating differences in populations, dates, exclusions and totals. |
| Source data was available through Snowflake Cloud, while downstream reporting needed its own preparation and organization. | Connect to the authorized Snowflake datasets and pull the required data into SQL Server for transformation and reporting. |
| Changes in the source system can affect downstream calculations and reports. | Separate source ingestion from analytical transformations, so a change can be evaluated at the right stage. |
| A successful transfer does not prove that a reporting dataset is complete or analytically correct. | Check source coverage, duplicate records, missing values and reconciliation totals alongside processing-status checks. |
Connecting Snowflake to SQL Server. Snowflake is the upstream source and SQL Server is the downstream environment where the data is organized, transformed and prepared for reporting. The processing flow is: source data in Snowflake Cloud, controlled extraction, SQL Server staging, analytical transformations, reporting datasets. This keeps the owner’s data separate from the program’s own reporting logic, and it separates questions about whether source data is available from questions about how a measure is calculated.
Preserving the analytical meaning. The central priority was equivalent analytical behavior. SAS and SQL Server handle missing values, dates, sorting and sequential processing differently, and those differences matter when a report depends on finding an initial event, following later activity or selecting records inside an observation period. The conversion therefore centered on the purpose of each calculation:
- Which records belong in the reporting population?
- How are related records linked?
- Which event establishes the beginning of an observation period?
- How are missing, duplicate or corrected records handled?
- Which exclusions affect the result?
- How should the result reconcile with the established reporting output?
What the organization gained. A SQL Server foundation for reporting, with structured transformations and reusable reporting datasets. A connection that brings authorized Snowflake source data into the downstream workflow. A clearer separation of responsibilities, so extraction, preparation, calculation and reporting can each be managed as a distinct stage. And continuity of reporting definitions, because the migration focused on preserving the meaning of established measures while changing the technology that produces them.
Why it matters. A reporting migration has to preserve more than rows and columns. It has to preserve the analytical definitions that make the information useful. This project paired a SAS to SQL Server move with Snowflake integration, in an environment built around consistent processing and results people can interpret.
How do you work out whether the move will save money?
We do not quote a percentage saving. SAS licensing is quoted per customer, published estimates vary widely and rest on assumptions that may not match yours. A useful comparison is a three-year cost model built from your own numbers:
- SAS: the products and components you license, your renewal quote and date, hosting, and the people who maintain the programs.
- SQL Server or Azure SQL: the edition that fits the workload, licensing method, infrastructure, backup and monitoring, plus R or Python if statistics move.
- One-time costs: assessment, translation, reconciliation, parallel running, training and cutover, and re-validation where required.
- Ongoing differences: tools and environments you can retire, and the skills you need to keep.
Almost all Everconnect consulting work over the last 24 months has been billed between $125 and $145 per hour. There are no setup fees and no minimum contract length. We estimate after the free, no-obligation discovery call and an assessment. See our pricing page for the full picture.
Which SQL Server should you move to?
Pick a target that is still supported. SQL Server 2016 ended support on July 14, 2026, so look at SQL Server 2022 or 2025, or Azure SQL. Microsoft lists SQL Server 2025 Standard at up to 4 sockets or 32 cores and 256 GB of buffer pool memory, with SQL Server Agent included, while Enterprise edition lifts those limits. If statistics will move too, Microsoft documents SQL Server Machine Learning Services for running Python and R scripts next to the data, available in SQL Server 2017 and later. Since SQL Server 2022, the R and Python runtimes are installed separately rather than by SQL Server setup. If your source data is in Snowflake, Azure Data Factory has a Snowflake connector for copying data.
Where should you start this week?
- List every SAS program, macro, format catalog and scheduled job, and who owns each one.
- Find out which SAS products you license and the renewal date, and your SAS 9.4 maintenance release.
- For each output that leaders use, name the report, its audience and the approved version you can compare against.
- Mark which programs are data preparation and which are statistical procedures.
- Write down the definitions that must not change: populations, exclusions, event dates, how duplicates and missing values are handled.
- Record where the source data lives, how it arrives, and who owns it.
- Decide the goal: lower cost, one governed data platform, easier handover, or all three.
Get help
Everconnect Data Systems provides migrations from SAS to SQL Server and Azure SQL, including integration with cloud sources such as Snowflake. Book a free, no-obligation discovery call to talk through your SAS environment, or see our database migration services, SQL Server consulting services and managed database services. Once the data is in SQL Server, the SQL Server Health Check ($499 per server) can review the new server’s configuration, security and backups.
Frequently asked questions
For much of what SAS does in business, yes: data preparation, joins, grouping, aggregation and scheduled reporting datasets. SQL Server is a database, not a statistics package, so advanced statistical procedures usually stay in SAS or move to R or Python. SQL Server can run Python and R scripts in the database through Machine Learning Services. An assessment sorts your programs into those that move cleanly and those that need another home.
The reasons we hear most are the recurring license cost, the SAS 9.4 support schedule, fewer people who can read SAS code, data that already lives in SQL Server, Azure or Snowflake, and programs that few people understand or can audit. Every organization has its own mix, so we start by listing yours and testing it against a three-year cost model.
No. SQL Server Migration Assistant supports Access, Db2, MySQL, Oracle and SAP ASE as sources, but not SAS. SAS programs are translated by people who understand both environments, and the results are checked against the SAS output. The data itself can be loaded with several methods, each with trade-offs.
Partly. Conversion tools and AI assistants can draft SQL for simple steps, and PROC SQL is already close to SQL. DATA steps that depend on row order, retained values, BY groups and missing values are where automatic conversion goes wrong, because the SQL runs without errors and returns different numbers. Treat any draft as a suggestion to review and reconcile against the SAS output.
Common options are SAS/ACCESS Interface to Microsoft SQL Server, which writes tables from SAS; delimited files loaded with BULK INSERT or bcp, which lose labels, formats and numeric precision; SSIS or other tools reading through ODBC or OLE DB, which generally need a SAS session or server; and Python or R scripts. Format catalogs and labels are exported separately and become lookup tables.
Not one to one. A SAS missing value is a known value that can be compared and sorted, and SAS has 28 distinct missing values. NULL in SQL Server means unknown, so comparisons with it are not true and filters can return fewer rows. SAS’s documentation lists differences in filtering, MIN, outer joins and sorting. Write each rule down and test it with real data.
SAS stores a date as the number of days since January 1, 1960, and a datetime as the number of seconds since midnight on that date. A format only changes how the number is displayed. On load, convert the number into a date or datetime2 value, for example by adding the day count to January 1, 1960, and check any date arithmetic and reporting periods.
Window functions. ROW_NUMBER identifies the first or last row per group, LAG and LEAD read neighboring rows, and a running SUM with PARTITION BY and ORDER BY replaces many retained totals. The ordering must be explicit, including a rule for ties, and results are checked against SAS output because a small ordering difference can change which record counts.
Not always. A DATA step merge by key steps through ordered data and, when more than one input has repeated key values, matches rows one to one within the group. A SQL join returns every combination of matching rows, so row counts can differ. Define how the tables relate, then write the join or window logic that matches the intended rule.
User-defined formats usually become lookup tables or CASE logic, so the value-to-label mapping is documented and reusable. Macros are reviewed for what they generate. Some become stored procedures with parameters, some become SQL Server Agent job steps, and some are retired. Generated code that nobody has read in years is a priority for the assessment.
It depends on how many programs, macros and outputs exist, how many are order-dependent or statistical, how many source systems feed them, how strict the reconciliation must be and how long a parallel run is needed. A written assessment turns those counts into an estimate. We do not quote a duration before we have seen the programs.
Almost all Everconnect consulting work over the last 24 months has been billed between $125 and $145 per hour, so 40 hours is about $5,000 to $5,800 and 80 hours about $10,000 to $11,600. A migration is a larger engagement than that, and we estimate after the free, no-obligation discovery call and an assessment. There are no setup fees and no minimum contract. See our pricing page.
SAS lists SAS 9.4M9, released in June 2025, in Standard Support until July 1, 2030, when the platform moves to Limited Support. 9.4M8 is in Standard Support until February 1, 2028. Earlier releases are already in Limited Support, which SAS says has no security patches and is not recommended for production-type systems. Confirm your release in SAS’s support policy.
It depends on what your programs do. If they rely heavily on SAS procedures, an upgrade within SAS may fit, and it is a different project from moving to SQL Server. Either way, compare the renewal quote and the one-time work against a three-year model. We support the SQL Server path, and we will tell you if your workload points elsewhere.
They do different jobs. SQL Server is where governed data and set-based preparation live, and Python or R is where statistical and machine learning work happens. Many designs use both, and SQL Server can run Python and R in the database. Which parts go where depends on your programs, your team’s skills and what has to be re-validated.
Yes. SAS/ACCESS Interface to Microsoft SQL Server, a licensed SAS product, lets SAS read and write SQL Server tables. A hybrid design moves storage and data preparation to SQL Server first and leaves statistical work in SAS. It lets you migrate in phases and shrink the SAS footprint at your own pace.
By reconciliation. Compare the populations, dates, exclusions and totals produced by the SAS programs and by the SQL Server logic, then investigate every difference until it is explained. Also check source coverage, duplicate records, missing values and row counts at each stage, and run both systems in parallel for an agreed period before the SAS processing is retired.
Yes. A common pattern is controlled extraction from Snowflake into SQL Server staging tables, then transformations and reporting datasets, which keeps source data separate from your own calculations. Azure Data Factory has a Snowflake connector for copying data. Whether to transform in Snowflake or in SQL Server depends on cost, skills and where your reporting already lives.
Related guides
- Migrating legacy databases to SQL Server: the complete guide
- Is your business running on a Microsoft Access app? What to do before it breaks
- Is your business running on Excel spreadsheets? When to move to SQL Server
- Should you migrate from Oracle to SQL Server? Costs, risks and how it works
- Should you migrate from Sybase (SAP ASE) to SQL Server? Reasons, risks and how it works
- Should you migrate from PostgreSQL to SQL Server? When it makes sense and when it doesn’t
- Should you migrate from MySQL to SQL Server? Reasons, risks and how it works
- Should you migrate from Db2 to SQL Server? Reasons, risks and how it works
- Is your business trapped on Visual FoxPro? How to migrate to SQL Server safely
- Upgrade SQL Server or move to Azure? A decision guide for older databases
- SQL Server migration with minimal downtime: methods compared
- How to choose a SQL Server migration consultant (and what to ask)
Updated November 2, 2026. Written by Nathan Jaskot, founder of Everconnect Data Systems, a US-based, veteran-owned database consulting firm founded in 2010. SAS and Microsoft facts were checked against their documentation on that date (sources below). Confirm your own SAS release and dates with SAS.
Sources (checked November 2, 2026)
- SAS Support: Support for SAS 9.4 and earlier releases
- SAS Blogs: Upcoming support milestones for SAS 9.4 customers
- SAS Documentation: Potential result set differences when processing null data
- SAS Documentation: SAS date, datetime and time values
- SAS Documentation: BY-group processing in the DATA step
- SAS Documentation: SAS/ACCESS Interface to Microsoft SQL Server
- Microsoft Learn: SQL Server Migration Assistant (supported sources)
- Microsoft Learn: SQL Server Machine Learning Services (Python and R)
- Microsoft Learn: Copy and transform data in Snowflake with Azure Data Factory
- Microsoft Learn: Editions and supported features of SQL Server 2025
- Microsoft Lifecycle: Ending support in 2026
About the author. Nathan Jaskot is the founder of Everconnect Data Systems, Inc., a US-based, veteran-owned database and technology consulting company he started in 2010. Everconnect works with SQL Server, PostgreSQL, MySQL, Oracle, Azure and AWS. Learn more about Everconnect.






