BookmarkSubscribeRSS Feed

Effortless SAS EG to Viya Migration: Modernize Workflows Without Disrupting Business Continuity

Started a week ago by
Modified 2 weeks ago by
Views 274

Co-Developers & Authors: Afshin Mirtorabi (Afshin.Mirtorabi@sas.com)  & Irina-Gabriela Popescu (Irina-Gabriela.Popescu@sas.com)

 

Ready to modernize your SAS workflows without losing momentum?


Migrating from SAS Enterprise Guide (EG) to SAS Viya can feel like balancing business continuity with the pressure to innovate. But what if you could keep your projects running smoothly while tackling the toughest migration headaches—like those stubborn hard-coded file paths?

 

This blog blends the best of both worlds: connect EG to Viya for instant compatibility (EG to Viya Connection Blog), and use a targeted path-modification workflow to clear legacy roadblocks. Whether you’re a systems engineer, analyst, or team lead, this guide will help you cut friction, minimize risk, and unlock Viya’s full potential—without a disruptive overhaul on day one. Let’s dive into a pragmatic approach that keeps your business moving and your tech stack evolving.

 

If you would like to read about how this task was completed 10 times faster using all of Viya's integrated capabilities then you can head to my other blog and get your recipes ready!; Engineering Excellence: Creating a Michelin Star Analytics Experience with SAS Viya 

 

Why blend these approaches?

 

Most teams want two outcomes at once: keep business running and reduce migration toil. Connecting EG to Viya gives you the supported runway to execute existing projects on a modern platform. The path‑mod approach adds a targeted clean‑up layer so you’re not blocked by legacy Windows/UNC (Universal Naming Convention) paths when running on Linux‑hosted Viya or cloud storage. Used together (with SAS support), you’ll cut friction without committing to a full refactor on day one.

 

Connect EG to Viya

 

What you get: Keep your familiar EG UX while running code on Viya’s SAS Compute (and, where applicable, leveraging CAS for scale). It’s an official path that buys you time to plan modernization, especially if you are using conditional tasks and copy files task to move files from and to your local machine / networks.

 

GeorgeBeevers_0-1759910193090.png

At a glance you will:

  1. Update EG to 8.4 or later (See Wha’s New and SAS Enterprise Guide Standalone Install).
  2. Create a Viya connection in EG using your Viya URL; authenticate with your site’s SSO/credentials.
  3. Choose the Viya server context in EG, then run projects/programs as usual.
  4. Iterate: start taking advantage of Viya features (e.g., SAS Studio, Background Submits, Custom Steps, Visual Analytics, Information Catalog, embedded Python, CAS actions and many more) as your confidence grows.

When this is enough

 

Your projects are already “path‑clean” or rely on libraries that resolve correctly on Viya.

 

A custom Path‑Modification Workflow

 

What it solves: .egp projects often embed hard‑coded paths inside:

  • SAS code nodes (LIBNAME, FILENAME, %INCLUDE, PROC IMPORT/EXPORT, etc.)
  • EG task XML (notably Copy Files tasks with source/destination).

On Viya, these stale C:... or \server\share... references cause failures. The workflow below finds and updates them systematically.

 

How it works (nuts and bolts)

 

Scan/report (EGP Path Finder)

 

  1. Treat the .egp as a ZIP and inspect:
    • project.xml (UTF‑16 LE, BOM‑bearing),
    • CodeTask-*.code.sas,
    • EGTask-*.xml.
  2. Use compiled regex for Windows/UNC and Unix path shapes; detect context around LIBNAME, FILENAME, %INCLUDE, and PROC file options.
  3. Normalize candidate paths (convert \→/, strip C: or \server\share, prefix a Viya root like /opt/warehouse).
  4. Skip macros (&var, %something) to avoid breaking dynamic code which occurs when using copy files task or in open
  5. Emit a concise CSV report (what to change, from→to) and an HTML view for review.

Apply changes (EGP Modifier)

 

  • Backup each .egp (timestamped).
  • Perform context‑aware substitutions in SAS code (annotate changes with comments).
  • Parse EG task XML structurally (e.g., update source=/destination= attributes) instead of blunt text replace; preserve encoding (UTF‑16 for project.xml, UTF‑8 for .sas).
  • Rebuild a valid .egp.
  • Package both steps as Viya Flow Custom Steps so non‑coders can run them via a form

 

Mini‑example (conceptual)

 

Detect a Windows path inside LIBNAME and rewrite to a Viya prefix.

 

GeorgeBeevers_1-1759910234823.png

 

Code Comments

GeorgeBeevers_2-1759910246109.png

All this code seems hard…there must be a simpler way? I really don't want to read 1000's of lines of code and make changes in the code.

 

Welcome! - The Viya Advantage: Making the Utility a Custom Step

 

While a SAS program is effective, the real power of this utility is unleashed when it's packaged as a Custom Step in SAS Viya. This transforms the command-line script into a user-friendly interface that any user—regardless of their coding expertise—can use to automate path changes.

 

EGP-PathFinder

 

GeorgeBeevers_3-1759910286051.png

 

EGP-Modify

 

GeorgeBeevers_4-1759910306779.png

 

A custom step provides a graphical user interface (GUI) with control options that map directly to the SAS macro variables in our code. This eliminates the need for users to manually edit any code. The interface would include the following controls:

 

  • File Selection (Required):
    • Control Type: File Browser
    • Mapping: CSV_PATH_MACRO
    • Description: This control allows users to browse and select the CSV file containing the old_path and new_path mappings.

 

  • Target EGP File (Optional):
    • Control Type: Text field
    • Mapping: TARGET_EGP_FILE
    • Description: An optional field where a user can enter the path to a single .egp file they wish to process. If this field is left blank, the script will automatically process all projects listed in the CSV file. This provides flexibility for both mass-updates and one-off fixes.

 

  • Create Backups (Optional):
    • Control Type: Checkbox
    • Mapping: CREATE_BACKUPS
    • Description: A simple checkbox to enable or disable the creation of timestamped backups. This is a crucial safety feature that gives users confidence.

 

  • Backup Directory (Conditional):
    • Control Type: File Browser
    • Mapping: BACKUP_DIR_MACRO
    • Description: This control becomes active only if "Create Backups" is checked. It allows the user to specify the location where the backup .egp files should be stored.

 

  • Verbose Logging (Optional):
    • Control Type: Checkbox
    • Mapping: VERBOSE
    • Description: A checkbox that, when selected, provides detailed output in the SAS log, showing every single path change made by the script. This is invaluable for troubleshooting and auditing.

 

Putting it together

 

  1. Move EGP to Viya – Get your project moved to Viya so that you can utilise the custom step. Its as easy as drag and drop or select using the file selector.

 

GeorgeBeevers_5-1759910333162.png
 
2. Select the EGP – Using the pop-up prompt select the EGP that you moved to Viya. You will need to select “File” first and then the box becomes present. If doing folders select that.
 
GeorgeBeevers_6-1759910403151.png

 

The custom step allows you to modify the prefix path with its default being "/opt/warehouse" for the development of this process. If you are using this site wide you can edit the custom step and change the default for everyone. If you are working with SAS Managed Cloud Services for your system then the Professional Services team will make sure that path mapping is present to enable simple substitution.

 

GeorgeBeevers_7-1759910430813.png
 
3. Run EGP-Pathfinder – Select the node in the studio flow and chose “Run to Node”. This will generate a table called PATHS_TO_CHANGE.

 

GeorgeBeevers_10-1759910573010.png

 

4. Review PATHS_TO_CHANGE -  Review the table and ensure that you are happy with the paths that its found. If you need to make amendments you can do it directly to this table. The table is held as a CSV and is only read to provide a visual in the flow. So for instance if the New Path isn’t quite right you can manually override it at this stage.

 

GeorgeBeevers_11-1759910604526.png
 
5. Run EGP-Modifier – Everything should be all set so now select the CSV and the file or fodders to apply the changes to. The process will now deal with everything for you. Don’t forget to enable backups before you run if this is the only copy you have.
 
GeorgeBeevers_12-1759910634698.png

The Results

 

Copy Files Task

 

GeorgeBeevers_13-1759910653512.png

 

Code

 

GeorgeBeevers_14-1759910664826.png

When to choose which path

  • EG‑only (for now): Your libraries and paths resolve cleanly on Viya, and you want minimal change.
  • EG + path‑mod: You have lots of embedded Windows/UNC paths or Copy Files tasks, and you want fewer run‑time failures without hand‑editing dozens of nodes.
  • EG → Studio (later): You’re ready to re‑model flows for Viya‑native capabilities (or to exploit CAS at scale).

 

The Result: Faster, Easier Viya Migration

 

By automating this tedious and error-prone process, this utility delivers significant benefits:

 

  • Speed: What would take days or weeks of manual effort can now be completed in a fraction of the time.
  • Accuracy: The script ensures that every instance of a hard-coded path is updated consistently, eliminating human transcription errors.
  • Efficiency: The process is self-contained and can be run in batch mode, freeing up your time to focus on other critical migration tasks.

This utility is a powerful example of how combining SAS with other technologies can solve real-world problems, making the transition to SAS Viya smoother and more efficient.

Contributors
Version history
Last update:
2 weeks ago
Updated by:

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags