I would like to make changes in all SAS programs in a folder.
For example I would like to replace "Apple" with "Orange" in all the programs that has "Apple". Is there a way to it in one shot?
You could write SAS code that reads each line of each program in the folder, and then changes "Apple" to "Orange", and then writes the text out to a new file. I wouldn't be surprised if some program to do this already exists. And of course, there are non-SAS ways to accomplish this as well.
If the text in this example is something like a server location, or something else that you know might change in the future, I handle this by setting a macro variable with the location of the server location in my AUTOEXEC file, and then I use this macro variable in every program that refers to this server location. At some point in the future, when the server location changes, I only have to change the value of the macro variable assigned in the AUTOEXEC, and all my programs will refer to the new server location.
Aside from contemplating the use of (a) macro variable(s), as @PaigeMiller suggested, this might also be an opportunity (if you work on a UNIX system) to get yourself acquainted with find and awk.
But the OS is Windows.
Google finds many utilities that will do this. Search for
bulk change text in folder
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.