BookmarkSubscribeRSS Feed
charles_s_patridge
Calcite | Level 5

I am new to SAS EG and we have a number of EG projects.  These projects can have quite a few code blocks (sas code) and would like to know of a way where a programmer could search through the code blocks looking for specific text strings or variable names.

I have tried using WINZIP to open up an EG project but all the code blocks have the name of "code.sas" and unable to save these code blocks within a specific directory because they all have the same name and I really do not want to have to rename each code.sas to another name.  If I was able to save these all in a single directory then I can use search tools to do what I would like to do.

It would really be nice to have this feature built into SAS EG project but have not been able to find such a utility.  It would be nice to have a feature for SAS code much like the "Project LOG" - to be able to see all the code in a single window/view to do a search.

Any help would be great.

Charles Patridge

7 REPLIES 7
art297
Opal | Level 21

Chuck,

I, too, am new to EG, but think that making the code segments so that they ARE NOT embedded will allow you to search through them like you would with any regular SAS code.

Art

Patrick
Opal | Level 21

If this is kind of a "once-off" then you could just export the whole projects as code (file/export/export all code in project...).

If you want this to do this on a regular bases then I think you need to use the project.xml file in the .egp zip archive as starting point to kind of mimik what the export does for you - or you try to figure out what "export all code in project..." is actually doing and if you're able to call this "module" from outside EG with something like VB. Not my area though but may be someone can tell you more.

DF
Fluorite | Level 6 DF
Fluorite | Level 6

I've done as Patrick says myself, as a one-off.

7-zip allows you to extract multiple EGP files at once into folders named after each project, and maintains the structure within the .egp zip format files.  This allows you to extract all of the code.sas files, as they're actually split into seperate files.  The normal windows search function then allows you to search through all the files for the keywords you're looking for.

It's not ideal for anything but a one-off exercise mind you.  Also I couldn't see a way to tie the code.sas file with its name in the EG project - I guess it's stored in project.xml somewhere though...

Jay_OAG
Calcite | Level 5

A way to get all the code from a process flow is from the Create Stored Process wizard. Then you could just search in one code node (Program).

Work-Around:

Right-click your process flow in the Project Tree

Choose "Create Stored Procss"

Click NEXT in the wizard (don't worry about any parameters, this will be cancelled)

Copy all the code (Ctrl-A will select all)

Cancel wizard

Paste in a code node (Program)

charles_s_patridge
Calcite | Level 5

To ALL,

Chris Hemedinger of SAS Institute provided me with a solution that works.  The code/tool to do this is located at this URL - http://blogs.sas.com/content/sasdummy/2013/01/25/egp-search-tool2/

You can download the tool on your Windows Platform and run the code without having to get your IT people involved.

Thanks Chris for the tool and making it available to all.

Charles Patridge

jakarman
Barite | Level 11

Charles still wondering  what:

-  you do mean with Without IT people involved?

   In a professional organization desktops are closed ones and are as the server being monitored on not allowed changes.

   As Eguide in dependent on the Windows registry and you have to change the installation of EGuide I am seeing a contradiction.

- What is your goal with that search-tool?

  As not all code is needing to be present in EGP project it can contains links to where the code really is.

  It can be even located on a server and being under control of release management by that having underpinned the used version.

---->-- ja karman --<-----
charles_s_patridge
Calcite | Level 5

Unless your desktop/laptop is restricted to add software, you can install Chris' tool on your desktop without having to involve IT folks.

My goal is to find/replace text strings within EG projects.  Not all people who code EG projects use links to outside code.  And when you have over 4000 EG projects to monitor or maintain then finding text strings is EXTREMELY cumbersome.  Ideally, I would have liked a FIND and REPLACE tool.  But Chris Hemedinger's tool can at least find the text string and provide an output that can be used as a check off list so if changes are needed, you can keep track of  what changes are needed.

As for all code not being within EG projects, I can still do a text string search using existing tools outside of EG.  That is a minor task compared to opening each and every EG project, searching through each program node for a specific string. 

I understand in the newer version of EG (7?) that there will be a search facility but it will not currently allow you to search other EG projects without opening each one.  Eventually, I will HOPE that SAS Institute will have such a tool as Chris' to make maintenance easier, including a FIND and REPLACE within an EG project but also able to do this outside of an EG project without having to open it first.

Charles Patridge

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 9476 views
  • 4 likes
  • 6 in conversation