BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

How to compare two SAS codes in SAS EG 7.1?

17 REPLIES 17
TomKari
Onyx | Level 15

Could you expand on this a bit? It's not clear what you're trying to do.

Tom

Babloo
Rhodochrosite | Level 12

I've two similar SAS programs but they seem to have somo differences between them. Since it is long program it will be little difficult to do a manual comparison.

So how this can be achieved in SAS EG like we do a code comparison in text editor like Ultra Edit?

Kurt_Bremser
Super User

Seems like your best option will be to save the programs as .sas files and use an external tool like ultraedit (or diff on UNIX) to do the compare.

Quentin
Super User

From this blog post from Chris H., EG 7.1 includes the ability to diff files, as one part of real version control it introduces (via GIT).  So looks to me like you are in luck (I'm not on 7.1 yet, so haven't tested.  Guess I'm not in luck. : )

http://blogs.sas.com/content/sasdummy/2014/10/12/eg-71-new-programmer-features/

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
jennifert
SAS Employee

There is also information about the ability to compare programs in the SAS Enterprise Guide 7.1 help.  This ability is part of the new program history feature.  You can use your program history to compare two different committed versions of a program, and you can compare a committed version of the program to the code that is currently in the program editor.

In the table of contents, expand "Working with Programs" and then "Understanding program history", or search for "program history".

Thanks,

Jennifer


Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF

Babloo
Rhodochrosite | Level 12

Thanks for the reply. It is really helpful.

However I couldn't figure out why 'History' on the program toolbar is disable for me.

I've the programs (Client.sas and Client_updated.sas) saved in UNIX server under the folder called /data.

Kurt_Bremser
Super User

The compare function within EG works only if you have already used the internal version control system for the SAS code within the project.

In your situation, I would start with using

diff /data/Client.sas /data/Client_updated.sas

from the commandline on the UNIX server and look at the output. It is a bit cryptic, but it provides all the answers. (info diff)

jennifert
SAS Employee

Before you can use the program history feature to commit program changes and compare different versions of a program, your programs need to either be embedded in your project or stored in a Git repository.  There is information about this in the program history section of the help:  I'd recommend the topics entitled "Committing your program changes"  and "Understanding embedded programs."

I hope that helps!!

Thanks,

Jennifer


Catch the SAS Global Forum keynotes, announcements, and tech content!
sasglobalforum.com | #SASGF

Quentin
Super User

Hi Jennifer,

On that note, is there any chance a future EG version might allow .sas files that are linked to an EG project (rather than embedded) to use the EG project file local GIT repository (if that is the right language)?

I may be an oddity, but as I've been working more with EG these past couple years, I've become a fan of EG projects, but I store all of my .sas code on the server and have only links from the project file to the .sas files.

I don't know enough about the architecture of EG (or GIT) to know if there is hope that a future iteration of this new version control approach could work with linked .sas code (and perhaps other linked files...).

Thanks,

--Q.

BASUG is hosting free webinars Next up: Jane Eslinger presenting PROC REPORT and the ODS EXCEL destination on Mar 27 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
CaseySmith
SAS Employee

Regarding Quentin's question...  external .sas files (referenced in EG projects via file system or UNC paths) can be stored in external Git repositories.  In this case, EG's Program History features (commit, view history, compare, revert, etc.) are available and execute against the external Git repository.  (Whereas, embedded programs (in EG project) are tracked in the embedded Git repository (also in EG project).)

However, the Program History feature doesn't really support .sas files referenced from the server (Server's Files location).  The reason...  even if the file was stored in a Git repository on the server, EG would not typically have shell access to the Git repository to issue Git commands.  Nor would we want to try to track changes in the "local" Git repo (embedded in the EG project), because it would only track changes to the file made from within that project.  So, if you wish to use the Program History feature with externally referenced .sas files, we recommend referencing them from an external (locally cloned) Git repository (accessible to your file system).

Casey


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

CaseySmith
SAS Employee

To compare two programs in EG 7.1, multi-select (Ctrl+Click) the two programs in the Project Tree or Process Flow, then right-click either of the two programs, and select the Compare context menu item.

Note: This comparison feature requires a one-time installation and specification of a 3rd-party file comparison tool (I like WinMerge) in EG's Tools->Options->File Comparison.

The Program History feature provides additional versioning capabilities.  For more information on the Program History feature new to EG 7.1, see this paper:

http://support.sas.com/resources/papers/proceedings14/SAS179-2014.pdf


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

Babloo
Rhodochrosite | Level 12

I did multi-select (Ctrl+Click) the two programs in the Project Tree and I got the warning as follows as soon I select 'Compare'.

'An custom file comparison tool must be configured to complete this action'.

You did mention  about the installation of 3rd party file comparison tool to enable this feature. But I'm not sure to have this done.

Kurt_Bremser
Super User

As Casey already suggested, I also recommend WinMerge. If you don't have admin permissions on your PC, have your admin download and install it.

Babloo
Rhodochrosite | Level 12

may I request you to tell me, how admin will connect (or set up the interface between EG and WinMerge) WinMerge in SAS EG after the installation of WinMerge?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 2369 views
  • 6 likes
  • 7 in conversation