Bancova News and Announcements

How to replace text using powershell?

Picture of John Zhang
How to replace text using powershell?
by John Zhang - Monday, 9 November 2015, 8:11 PM

Suppose you have a few SAS programs done located in a study folder, and for some reason, you want to replace one statement in each file in 120 files!

You can definitely open each file and do the replacement.

But that is boring!

If you are working on Unix System, that is also easy, you can use sed or perl to easiy do the task.

What about if you work on the window system?

The following is a link to teach you how to use powershell on windows to do replacement


can you do it in SAS?


1) find the way to loop in one folder.

2) use SAS perl function to do the replacement.

Any body can contribute some code?