I need to change a variable name across all programs in a project. I'm going to go ahead and do a CTRL+H find and replace manually, and furthermore, replace it with a macro parameter that I'll add to the macros in which this variable resides (I know that it could have been done in the first place, but it wasn't).
I don't expect there's a better way but I just wanted to ask. I became familiar with Chris Hemedinger's article about searching SAS projects recently, but I do not believe that would allow for replacing text within programs.
Any suggestions for my future edification?
Unfortunately, there is not a find-and-replace tool that operates across all objects in a project, let alone across several projects.
The EGP Search tool can help you identify the items that you might need to change, but you'll have to open each project and change each manually.
Chris
No quick, easy answer. Technically, you could do it in SAS, but it would be a lot of work. Depends on how many files....
Unless you already know how to use perl, 3 might be a challenge.
If you are familiar with Unix scripting, you could download the "GNU on Windows" tools and write the script as a batch file.
Doc Muhlbaier
Duke
I have done this (not for EG, but just regular SAS, as I don't use EG)
Basically, Doc has the answer, but for his step 3, I just used ordinary SAS code, not Perl regular expressions. The FIND command in SAS is useful for finding lines that have the desired target string, and the SUBSTR command allows you to pull apart the text and make replacements.
Doc & Paige, thanks for those suggestions. The drawback is that (and I didn't make this explicit before) these programs may not be actual physical files-- in an EG project, you can have a program that just lives in the project rather than having a shortcut to a program that lives outside of the project.
Unfortunately, there is not a find-and-replace tool that operates across all objects in a project, let alone across several projects.
The EGP Search tool can help you identify the items that you might need to change, but you'll have to open each project and change each manually.
Chris
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.