06-28-2011 12:23 PM
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
Please let us know your thoughts or any sample code.
Thanks in advance.
06-28-2011 12:35 PM
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.
06-28-2011 12:49 PM
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.
06-28-2011 09:39 PM
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.
06-28-2011 10:52 PM
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.