How to search your SAS Enterprise Guide projects (2013 version)

91

Last year I published an example application for searching your SAS Enterprise Guide project files (EGP files). The example shows off some of the cool features of the automation API, and it's a useful tool.

As neat of an example as that was, it had some limitations. It worked only with SAS Enterprise Guide 4.3 installations, so v5.1 users couldn't use it. And some users noticed a strange behavior where the app littered your current directory with a collection of temporary files. The app didn't support searching subfolders, a popular request from those who tried it. I'm the first to admit that the app stretches the capabilities of SAS Enterprise Guide automation.

In response to these issues, I built a new version: one that does not use the automation API but instead uses techniques that are not documented for end users. This allows me to circumvent the aforementioned limitations and provide just a simple, useful tool. (But without the source code...)

Here's the new version (packaged in a Zip file):

>> DOWNLOAD link for the EGPSearcher tool (SAS Enterprise Guide 4.3, 5.1, 6.1, and 7.1/7.11/7.13)

Update 07May2017: Added versions for 7.13 to the package.
Update 07June2015: Added versions for 7.1 and 7.11 to the package.
Update 20Dec2013: Added versions for 6.1 to the package.

The Zip package contains multiple versions of the tool: one for 4.3, two for 5.1 (32-bit and 64-bit), two for 6.1 (32-bit and 64-bit), and two each for 7.1/7.11/7.13 (32-bit and 64-bit). Note: Because you're downloading this from the big scary Internet, you might need to right-click on the EXE file in Windows Explorer, select Properties and Unblock the program so that it can run.

If you have interest (and a bunch of EGP files), give this new version a test run. Let me know via the blog comments how it works for you. I want to know the good and the bad, as I'd like to make it a useful tool for all.

You can still refer to the original application and its source code as a reference for how to use the automation API from a .NET application.

Share

About Author

Chris Hemedinger

Senior Manager, SAS Online Communities

+Chris Hemedinger is the manager of SAS Online Communities. 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.  He also hosts the SAS Tech Talk webcasts each year from SAS Global Forum, connecting viewers with smart people from SAS R&D and the impressive work that they do.

91 Comments

  1. Pingback: How to search your SAS Enterprise Guide project files - The SAS Dummy

  2. Hi Chris

    Would you consider a blog on the diferences between XLS and XLSX support in EG. There are some significant improvements in Import and Export (plus an error handling problem) with XLSX

    Bobby

  3. Michelle Homes

    Hi Chris,

    Thanks for the updated version and considering our requests.

    In follow up to my feedback in your previous post, http://blogs.sas.com/content/sasdummy/2012/06/07/egp-search-tool/
    the subfolder searching now works a treat! I imagine it being extremely useful for other SAS users too. I noticed that in the returned results that it is sorted by the Project column. As my previous comment, it would be handy to be able to change the sort order by clicking on the column name so that it can be sorted by the Type or Folder etc. - perhaps in a future 2013V2 release? ;-)

    Thanks again and see you at SASGF13.

    Cheers,
    Michelle

  4. Hi Chris,

    I like your tool and it will help a lot.

    One question?
    What kind of licence use this tool? Cuz I wants to use ist in our company, but I have to take a look to the licence before? Will it ok, when we use your tool?

    An other question:
    Will it be possible for a future version to decrease the result list by a selection of 'Type' (may over a checkbox)?

    Thx for this great tool,
    Sascha

    • Chris Hemedinger
      Chris Hemedinger on

      Sascha, thanks for the feedback. The tool is free to use, but it requires that you have SAS Enterprise Guide installed on the PC where you run it. It's not a standalone tool; it depends on the components that are installed with SAS Enterprise Guide.

      And yes, filtering the results "by type" or other criteria is a good suggestion. I've had several suggestions for enhancements, so I'll try to work those in.

      • Jerry Prarat on

        Hello Chris,
        You stated that EG must be installed on the PC where you run the EGP search tool. I just wanted to confirm our situation. We have EG installed on a Citrix server, SAS is installed on a Win 2008 server. All of the EG projects are on the Win server. Are you saying that our server technical gurus must install your tool on citrix and then make it available to us as an icon on the citrix menu? Thanks.

        • Chris Hemedinger
          Chris Hemedinger on

          Jerry,

          Maybe. Or maybe it's more complex.

          The EGP files, EG application, and EGP Search tool must all be available together. The EGP Search tool can search only files that it can access from a local drive or network path (UNC notation or mapped drive). If your EGP files are on another Windows server and accessible only via the SAS Workspace filesystem, you might not be able to make that connection. If you can access the EGP files without going through the SAS server, then that can work.

  5. Evangeline Collado on

    Thank you Chris - this tool is great for finding EG projects. Is there a mechanism within EG that can search all tables in metadata to find a table having a specific string of text in the table name?

    For example, I want to look for a permanent data table on the SAS server that contains 'TERM' in the table name and I am not mapped to the physical path. Is there a way in EG that I can perform this type of search? Thanks so much!

  6. Chris
    Great tool, but it is only Windows. Are there any tools for sites where all the projects are stored on Unix Servers??

    • Chris Hemedinger
      Chris Hemedinger on

      Robin, there is not a tool that works directly with the UNIX file system. But, you can use the Copy Files task to grab a local cache of your EGP files, and then run this search tool on that folder. And because the Copy Files task supports wildcards and macro variables, you can "generalize" an EG project that copies the EG projects you want as a step, and then go use the EGP Search tool on the result.

  7. Costantino DLC on

    Hi Chris,
    thank you very much for your useful tool; I think there isn't other one to search into EG projects.
    We used it for an "Impact Analysis" on about 13000 projects (very useful to scan into subfolders), but on windows server 2008 with 16 GB ram the tool took all memory and run very slowly, also on folders with several hundred of file .egp.
    Seem that this tool retains on memory every file it analyzes, also if you restart a search with a new key-string; so to discharge memory I closed and reopened the utility several time.
    Is there a manner to speed the search on a lot of file to analyze?

    • Chris Hemedinger
      Chris Hemedinger on

      Wow, 13,000 projects! I can see where the tool might not scale well into a collection of that size. I'll take a look to see if I can optimize it a bit to be more efficient about releasing memory.

  8. Pingback: How to search your SAS Enterprise Guide Projects | Making Information Visible

  9. Pingback: How to search your SAS Enterprise Guide Projects « OptimalHq

  10. Anders Ekeland on

    Hi all,
    I find this tool usefull - and a bit frustrating. To take one thing at a time - line numbers this time around.

    The line numbers in the "Location" column seems to have no relation to the line numbers I have in the editor - how come? It very often says line no 1 - both in "program" and "last submitted code" - and it give reference to line numbers in the log - but I cannot find the text-string anywhare in teh active log's (two of them, side-by-side lay out) - bug or feature?

    /Anders

    • Chris Hemedinger
      Chris Hemedinger on

      Anders,

      The line numbers reflect the simple location in the count of lines as separated by line feed characters, and might not line up with what you see in the editor. In the background, regular expressions are used to ferret out the text you're seeking. Depending on what special characters you might include in your search string, that might affect the result.

      It's on my to-do list to improve the experience a bit, so I'll keep this in mind. If you want to send me a screen shot of a particular problem, I can take a look to see what's going on. chris.hemedinger[at]sas.com.

  11. Hi Chris

    I am getting the following error
    Error searching C:\Users\Desktop\BRM\TEST_DISC_PROD_5.egp: Request for login credentials canceled by user
    1 project files processed, found 0 matches

    Do i need to give the credentials for this program to run. If so how.

    Thanks
    Shomit

    • Chris Hemedinger
      Chris Hemedinger on

      Shomit,

      It's possible that the project is referencing content that resides on a remote server, and the search program cannot make that connection. If your connection profile doesn't have cached credentials (that is, it always prompts you for user ID/password), then the search program cannot follow through with the connection. Does this happen for all project searches or just this one project file?

      • Hi Chris

        Thanks for the reply it was happening for only one particular file. For all other files it is working fine. Thanks for the awesome tool. It is a great help.

        Shomit

  12. Hi Chris,
    Great tool, but before I make it available to my 200 users, I was wondering, assuming this is a free tool, will it remain free and what kind of support could we expect. We just migrated to win7 and sas9.4(eg6.1). I could extend my question to all your free custom tasks, they are so useful.

    Thank you for this great blog!
    Laurent

    • Chris Hemedinger
      Chris Hemedinger on

      Laurent, thank for the comments.

      The tools are all free - and they will stay free unless/until these become official features in a future release of EG. That has happened with some custom tasks in the past, but there is no guarantee which of these (if any) will end up in the product.

      As far as support, they are generally "as is", but very stable. Most of the tasks/tools are simple enough and do what they are supposed to. I do occasionally enhance them and ensure that they work in the most recent versions of EG. They are already used successfully by lots of customers. SAS Tech Support often recommends them to users.

  13. Pingback: New SAS programming features in SAS Enterprise Guide 7.1 - The SAS Dummy

  14. Hi Chris,

    I was happily using your EGPSearcher in EG 4.3 but since we moved to EG 6.1 I got this message: "Cannot locate SAS Enterprise Guide 6.1. Is SAS Enterprise Guide 6.1 Installed ?"

    Anyidea knowing that of course SAS EG 6.1 is indeed installed on my machine?

    • Chris Hemedinger
      Chris Hemedinger on

      Hi Philippe,

      Do you have 32-bit or 64-bit SAS Enterprise Guide? The version of your EGP Search tool needs to match (x86 or x64).

      Otherwise I'm not sure what's going on, but you might try to re-register SAS Enterprise Guide on your machine. Here's how.

      From a command prompt, navigate to the location where SAS Enterprise Guide 6.1 is installed. (Example: "C:\Program Files\SASHome\SASEnterpriseGuide\6.1")

      Run this command: SEGuide.exe /register

      Then see if the EGP Searcher (6.1 version) can find what it needs.

  15. Hi Chris,

    This tool is essential to my work. Thank you for producing it.

    I use EGPSearcher51.exe. Why does it fail to find matches sometimes?

    Phil

  16. Hi Chris,

    Thanks for putting this together. I'm using EG 7.1 x64 and your newest build. I'm getting the same error as Phillipe above. I have changed the register but it doesn't make any difference. Any ideas?

    Thanks,
    Dan

      • Thanks a lot, Chris. I formerly used WPS, and the ability to search projects is the only thing I miss since having moved to EG.

        • Chris Hemedinger
          Chris Hemedinger on

          Dan, I've just updated it with a version for EG 7.11. This version will not work with EG 7.1 though -- there is a small difference in the internal APIs. This means that I'll need to build a different version for the original EG 7.1. Will the EG 7.11 version help you?

          • I'm also having issue with the 7.11 version. Sounds like it is a version issue where we can't use with 7.1hf

          • Thanks for keeping up with this Chris. Unfortunately, no luck with 7.11 either. I still receive the "not found" error.

  17. I’d downloaded the source code of the EGPSearch sample application from http://support.sas.com/documentation/onlinedoc/guide/examples/SASGF2012/EGPSearch_Sample.zip. I changed the following variables to point to the current SAS 5.1 (64 bits) install location.
    PathToEGuideInstall
    PathToEGuideInstall = @"C:\Program Files\SASHome\SASEnterpriseGuide\5.1";

    // determine EG 5.1 location using InstallShield key
    using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
    {
    using (regKey = hklm.OpenSubKey(@"SOFTWARE\SAS Institute Inc.\Enterprise Guide\5.1", false))

    However, when I execute the program, I get “C:\\SASSample\\EGPSearch_Sample\\EGPSearch_src\\bin\\Debug\\SEGuide.exe” FileNotFound exception.

    Stack Trace:
    at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
    at SAS.Shared.SharedEnvironment.get_ApplicationVersion()
    at SAS.EG.ProjectElements.Element.SetModified()
    at SAS.EG.ProjectElements.Element.SetLabel(String strLabel)
    at SAS.EG.ProjectElements.ProjectCollection..ctor(IMetadataService metadataService)
    at SAS.EG.ProjectElements.ProjectCollection..ctor()
    at SAS.EG.Scripting.Project..ctor()
    at SAS.EG.Scripting.Application.Open(String fileName, String password)
    at SAS.EG.Automation.EGAutomation.OpenProject(String projectPath, String password) in C:\DotNetRoot\EGPSearch_Sample\EGPSearch_src\Core\EGAutomation.cs:line 87
    at EGPSearch.MainSearchWindow.SearchProject(String filename, String searchString) in C:\DotNetRoot\EGPSearch_Sample\EGPSearch_src\Core\MainSearchWindow.cs:line 129
    Could you please let me know what may cause the “SEGuide.exe” FileNotFound exception. I don’t get the same exception when execute the downloaded EGPSearcher51_x64.exe application.

    Thanks!
    Tiffany

  18. I have really enjoyed using your search tool. However, I have found that the 4.3 version does not provide consistent results from one run to another. I could run the search 5 minutes apart and get completely different search results. I can't think of a reason that this could happen other than the fact that we keep our SAS code on a unix server and our EG projects on Windows. Also, I noticed that if the code is not listed in the process tree even if it is called elsewhere in the code the search will ignore that code. Do you know if any of this is expected?

    • Chris Hemedinger
      Chris Hemedinger on

      Cheryl,

      No, I'm not sure what's going on here. If your SAS programs are stored on Unix while your EGP files are on Windows, it's possible that sometimes the EGP Search tool doesn't make the full connection to the remote server and so it doesn't manage to search the files that are on the Unix file system. Do you think that might be the case here, based on the results you're seeing?

  19. We have projects from 4.3, 5.1 and 7.1 in the same file path and there are too many to separate into other folders. Would it be possible for you to handle the unhandled exception that occurs when you use one of these search tools in a folder that contains projects from another EG version? I understand that it may not be possible to have one tool to search all versions of .egp (although that would be ideal), however if the tool could run on these projects that match the version and not error on those of other versions, that would be a great assistance.
    Also, will you be releasing a version for 7.1?
    Thank you.

    • Chris Hemedinger
      Chris Hemedinger on

      I've tried to work it so that the tool doesn't *stop* outright when it encounters a file it can't process. Is that what you're seeing?

      Re: the 7.1 version -- yes, I'm working on it. It's a little different so I need to take a slightly different approach.

      • Yes, that is what I am seeing. The message reads "Unhandled exception has occurred in your application. If you click continue, the application will ignore this error and attempt to continue...." If I click continue, it does not continue. The status panel shows that it is still 'opening' the version of .egp that stopped it. If you were able to handle this exception and continue through the remaining files in the path, that would be a great assistance for us. Much appreciated!

        • The other way that I have been thinking that I might be able to search all of my different versions of SAS EG projects would be to write a VB script that would unzip the .egp files and then change the .sas files into .txt files. Once I have a folder containing all of the SAS code files in text format I would be able to use search that is built into Windows File Explorer. I could have the VB Script run overnight to refresh the SAS text files. Do you see any hurdles to this approach?
          Thank you.

  20. Hi Chris,

    Recently I noticed a strange behaviour using the searcher. No matter what I Change in egp projects, the Searcher still reports the old values. It looks to me as it is using some cached information. Any idea on how to make sure the searcher uses the actual content of a project as input?

    • Chris Hemedinger
      Chris Hemedinger on

      The search tool does not cache information, especially in between sessions. If you exit the search tool, make a change and save your EGP file, then relaunch and use the search tool -- it should show you the latest changes.

      Is it possible that you have some backup/old EGP files still in the search path?

  21. Pingback: How to search your SAS Enterprise Guide Projects | OptimalBI

  22. I have EG 7.11 HF3 (64-bit) installed and I use it regularly and it seems to work without issue. When I try to run the EGPSearcher711_x64.exe program it says, "Cannot locate SAS Enterprise Guide 7.1"

    Any thoughts?

  23. Hi Chris,

    First: Great Tool. Helps very often.

    I have download the latest version of the tool. We use EG 6.1 and EG 7.11 HF3 (7.100.1.2805) (64-bit).

    When i try to use the 7.11 Version of the tool, i've got the same error message as Philipe.
    ---------------------------
    ---------------------------
    Cannot locate SAS Enterprise Guide 7.1. Is SAS Enterprise Guide 7.1 installed?
    ---------------------------
    OK
    ---------------------------
    Register didn't change anythink. Location of the seguide.exe is C:\Program Files\SASHome\SASEnterpriseGuide\7.1

    Any tipps?
    Thanks and take care.
    Jan

      • Well... I know its a fun project to support the community. Actually i got a error message with this exp\EGPSearcher711.exe

        Error:

        I have clicked continue but after serval minutes nothing happend so i close it. Now the system comes directly with a close application message up.

        Sorry that i have not better news and great thx for this tool.
        Keep going
        Greetings
        Jan

        • Merde.
          Error message is rejected by html codes: Here it is:

          Unhandled exception has occured in your application. If you click continue, the accplication will ignore this error and attempt to continue. If you click Quit, the application close imediately.
          The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.

          • I'm getting this same error. I love this program - the 5.1 version saved me a ton of time. Is there any workaround that anyone has found on the unhandled exception error? Thanks!

          • I have the same errors: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. Have any one found the solution to resolve it?

          • Chris Hemedinger
            Chris Hemedinger on

            You might have better luck if you can place the EXE in the SAS Enterprise Guide install directory, where it can find all of the application files that it needs.

          • Hi, Chris i have the same problem previously described. It throws the exception LibGit2Sharp.Core.NativeMethods.
            I tried to copy the EXE where there is SEGuide.exe, but it still throws this exception.
            The version of EG i m using is 7.12 HF5 (7.100.2.3472) (64-bit) on Windows 10.

            Thank you

            Giancarlo

  24. Hi Chris,
    thank you for sharing this great tool!
    It works nice on some of our directories, but it will crash with very long path names (digging in sub-sub-directories). The .NET error message is: "System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."
    Can you replicate this error and is there something you can do about it?
    Kind regards, Michael

    • Chris Hemedinger
      Chris Hemedinger on

      Michael, I've heard that before -- I don't have a workaround for this right now, other than to rearrange the file folders, of course. I'll try to take some time to look into it.

      • We found a partial solution to our problem: by assigning a drive letter to a network path, we were able to shorten the path length.

  25. Chris,

    Thanks for sharing! Unfortunately, the tool doesn't work with my installation. It won't find the path, but then when I run the exp version, it has the errors that other above show. Maybe because I have 7.12 and am running on Windows 10?

    Also, +100 on the request to have a version that can search multiple versions of EG projects. I have a bunch of old project that I haven't converted because I haven't needed them.

    • Chris Hemedinger
      Chris Hemedinger on

      John, yes, I'll have to rebuild to allow it to work with 7.12...and just have not been able to complete and test this yet.

  26. Hello Chris me again
    We are now looking into automating Enterprise Guide. When opening your project and trying to compile we are getting this error:

    The type or namespace name 'Scripting' does not exist in the namespace 'SAS.EG' (are you missing an assembly reference?)

    We did add a reference to the EGScripting DLL.

    Any advice ?

    thanks for all your help!

    • Chris Hemedinger
      Chris Hemedinger on

      You might need to change the VS Project properties to target a later version of .NET (4.51, perhaps), if you're using EG 7.1.

  27. Clint Rickards on

    Just stumbled on your tool. looks like it has a lot of potential for us. I have 7.12 HF4. and 5.1 installed, None of the appropriate exe files will find "asdf" I created in a test project, ot the tool fails. I see that you are working on a 7.12 build. I hope to see it soon!

  28. Carolyn Stormont on

    Hi Chris, we are using a Windows 12 server with EG 7.13. I am trying to use the EGP Searcher 7.11 and am getting the message 'unable to locate SAS EG 7.1'. Are we getting this message because of the difference between EG versions, or some other reason? Thanks!

  29. Eric Pennington on

    Hi, Chris.
    I am feeling a bit confused. We have EG7.1. I can't find an appropriate EGPSearcher .exe for this version in the zip file I downloaded, and the readme says in no uncertain terms that the 711 version won't work with EG7.1. Is there a version for 7.1?

    • Chris Hemedinger
      Chris Hemedinger on

      Hi Eric, I haven't published one for 7.1 proper -- most users have updated beyond that. Can you verify your exact EG version (Help->About)?

  30. Rob Richardson on

    Hi Chris, I'm also getting the "Cannot locate..." message. I've registered seguide.exe and I've also tried using the newer version of EGPSearcher711_x64.exe you referenced in an earlier post, but no luck. I noticed my EG 7.11 install is in SASHome2 instead of SASHome. Could that be causing a problem? I have the explicit folder path added to my windows path. My EG version is 7.11 HF5 64-bit. Any ideas? Thanks.

    • Rob Richardson on

      The EGP Search tool for version 7.13 installed successfully and is working with the EG 7.11 version. The EG 7.13 allowed me to specify the EG path which has SASHOME2, instead of SASHOME. Thanks.

  31. Finally I write a program without using the .dll inside BaseSAS, it capable to apply in all version of EG / Base SAS without any code change.
    It can easier to read the .sas/.egp file for each statement and found the act as a searcher.

    read .sas file as usual like txt file,
    read .egp file rename as .zip, then unzip it, and read all file like txt file

    Thanks.

    • Chris Hemedinger
      Chris Hemedinger on

      Glad to hear you have a process that works for you. It's not something that SAS can support officially, but as long as you're able to accomplish your goal -- good!

  32. Astrae_research on

    Hi,
    I think this tool used to work before but now it doesn't. SAS 9.4m5 on win 7 64 with EG 7.15 HF2 (7.100.5.6112) (64-bit). Tried it on several EGP files, same thing. The EGPSearcher is EGPSearcher713_x64.exe.

    Any idea? Would greatly appreciate any help!

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.MissingMethodException: Method not found: 'Double SAS.EG.ProjectElements.ProjectCollection.OpenProject(SAS.Shared.DNADecoder, System.Collections.Generic.List`1 ByRef, System.IO.FileShare)'.
    at EGPSearch.MainSearchWindow.SearchProject(String filename, String searchString)
    at EGPSearch.MainSearchWindow.btnGo_Click(Object sender, EventArgs e)
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    • Chris Hemedinger
      Chris Hemedinger on

      I've recently added an updated version of the tool to the ZIP file download in this blog post. You'll find an EGPSearch715 version in the package -- try that.

      • Astrae_research on

        Thank you! That error is gone but now another one popped up. "Error searching T:\xxxxxx.egp: Login required for Directory Service
        1 project files processed, found 0 matches"
        Happens to all egp and on this SAS everything is local and there are no connections outside.
        Thanks for supporting this tool!

        • Chris Hemedinger
          Chris Hemedinger on

          Hi -- I'm looking into this. Is T: a mapped network drive? Does it work with local EGP files on a local drive?

  33. Hi Chris,
    thanks for this usefull tool!
    Is there any oportunity to search in a folder (contains a lot of .egp)?
    I need to find one 'text' from more then 10 000 EG projects.

  34. Hi Chris,
    we use your wonderful EGPSearcher (V 7.13) installed on Windows Server 2008 and plan to migrate the SAS clients to Windows Server 2012 or 2016. Does the EGPSearcher work without problems under 2012 and 2016 Server? Alternatively, we would do the installation locally on Windows 10, which probably works?
    Kind Regards,
    Stefan

    • Chris Hemedinger
      Chris Hemedinger on

      Glad it's working for you. I'd say it should work on the Server systems as well. The tool is *most* sensitive to the version of EG that you have, which is why I've had to build a different version for each EG release.

Leave A Reply

Back to Top