How to compare SAS programs in SAS Enterprise Guide


Copy/paste is my favorite method for creating new SAS programs. In my work projects, I maintain a sort of genealogy of SAS programs, because the DNA of one program can be used to spawn many other SAS programs as its progeny. When things (inevitably) aren't working as I intend in one of these next-generation programs, I find that I need to compare that program against the original to see what I've missed.

My file-comparison tool of choice is WinMerge. It's free and easy to install and use. That's why I'm really pleased with the new Compare Programs feature in SAS Enterprise Guide 7.1.

Here is how you set it up.

1. Install a file comparison tool.

I like WinMerge. But some of my colleagues prefer Beyond Compare or KDiff. Your choice! Most of these tools can integrate with your file system so that you can compare any two files from Windows Explorer. They also integrate with source control systems, if you use those (Git, Subversion, etc.).

2. Set your File Comparison options in SAS Enterprise Guide

Select Tools->Options, then the File Comparison tab. Check "Use custom file comparison tool" and then select your tool of choice. There are built-in presets for the three comparison tools that I mentioned, or you can go "off road" and select your favorite with "Other".

Select your DIFF tool

3. Select the two files that you want to compare

In the Project Tree or Process Flow, you can select multiple programs by using the standard Ctrl+Click sequence or by "rubber banding" a selection with the mouse (Process Flow only). When you have exactly two programs selected, right-click and select Compare.

Compare programs menu
The comparison tool launches with the contents of each program loaded for comparison. Here's what mine looks like:

Code compare in action
Some additional notes:

  • The content you see in the comparison tool is a copy of your program. Therefore, if you use the comparison tool to make changes, these won't be reflected in your SAS Enterprise Guide project. Of course, you can copy the changed content to the Windows clipboard and paste it into the SAS Enterprise Guide program editor.
  • You can do more with file comparison when using the Program History feature, which I introduced in this blog post about new programming features in SAS Enterprise Guide 7.1.

About Author

Chris Hemedinger

Director, SAS User Engagement

+Chris Hemedinger is the Director of SAS User Engagement, which includes our SAS Communities and SAS User Groups. Since 1993, Chris has worked for SAS as an author, a software developer, an R&D manager and a consultant. Inexplicably, Chris is still coasting on the limited fame he earned as an author of SAS For Dummies


  1. Great tip. I will check the functionality. I have been using ExamDiff, a freeware from Prestosoft which so far has been very useful.

  2. High Value Tip, Chris.

    How can a user search, with one action, every code node in an Enterprise Guide Project for a specific text string?

  3. Pingback: Video: Demonstrating the new features in SAS Enterprise Guide 7.1 - The SAS Dummy

  4. chris,
    i suppose i DO NEED an executable ?
    We cannot have our users download an executable version, so we would only use a portable version.
    But then the dropdown-box doesn't give me a possibility to search for such a version.
    Am i correct ?

    • Chris Hemedinger
      Chris Hemedinger on


      Yes, you must have an installed file comparison tool in order to use this feature. Windows provides a command/console-based tool (FC), but that won't be useful from within SAS Enterprise Guide as an interactive window -- plus it's not nearly as nice of a tool. You might be able to find a minimal tool that allows you to install to a user profile area without requiring admin privileges.

  5. Pingback: Code debugging and program history in SAS Enterprise Guide - The SAS Dummy

  6. Chris, I don't see the "Compare" option in EG 8.3. How do I achieve comparing two SAS programs in EG 8.3?

    • Chris Hemedinger
      Chris Hemedinger on

      It's a little tricky. First, you must create a project. Then add the programs you want to compare to the project. Then select the programs (ctrl+click for multiselect), right-click and select Compare.

Back to Top