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".
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.
The comparison tool launches with the contents of each program loaded for comparison. Here's what mine looks like:
- 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.
10 Comments
Thanks Chris for sharing this option.
Sunil
Great tip. I will check the functionality. I have been using ExamDiff, a freeware from Prestosoft which so far has been very useful.
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?
LeRoy, there is a Project-Level search in SAS Enterprise Guide 7.1. I described it (along with some other tips) in this blog post.
Pingback: Video: Demonstrating the new features in SAS Enterprise Guide 7.1 - The SAS Dummy
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 ?
Pim,
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.
Pingback: Code debugging and program history in SAS Enterprise Guide - The SAS Dummy
Chris, I don't see the "Compare" option in EG 8.3. How do I achieve comparing two SAS programs in EG 8.3?
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.