BookmarkSubscribeRSS Feed
ren2010
Obsidian | Level 7

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

4 REPLIES 4
ballardw
Super User

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.

ren2010
Obsidian | Level 7

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.

Ksharp
Super User

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

sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10

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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1118 views
  • 0 likes
  • 4 in conversation