Hi,
I have a requirement to change the libnames in a library that houses more than 500 sas programs.Is there any way that I can write a SAS program that goes to each of these programs and changes the
library name?
Please let us know your thoughts or any sample code.
Thanks in advance.
Renjith
How many different LIBNAMEs are involved? What are the rules for changing the LIBNAMEs? If these two questions can't be answered cleanly then you may have some problems.
If there are only a few LIBNAMES involved I might suggest moving the declarations to a common AUTOEXEC.SAS or included file than all users can share if that is practical in your environment.
Here is how I plan to change the libnames:
In old server: I have all the programs in the following library:
libname old \\oldserver\\productionjobs
I need to change the above libname to the following:
libname new \\newserver\\production\\jobs
I only have the above mentioned libnames
Thanks so much for your reply.
SAS program is only a txt file.You can read .sas file just as .txt file and use data step and tranwrd() function to change these libname statement.
Ksharp
To simplify the edit activity, use a SAS macro variable to resolve the <libref> portion of your LIBNAME statement. You can use a %INCLUDE statement to include / execute a SAS code member that contains the %LET statements needed to resolve the current-value of the <libref> portion. And with that the actual LIBNAME statement and other code remains static.
Scott Barry
SBBWorks, Inc.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.