BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Batman
Quartz | Level 8

I'm running a bunch of programs with pre-written code that includes infile statements with URLs such as the code below.

 

infile '.\pbp\pbp_b1a_inpat_hosp.txt' delimiter = '09'x
dsd lrecl = 30000 firstobs=2 missover;

 

Of course, I can manually change the "." to a directory for each program, but I'm wondering if there is a way "point" the period to a directory.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

How many programs do you expect to modify?

 

With that first "directory" have to change again? Note, Paths for files really should start at a drive, or in the case of a url a server, so there is no ambiguity as to what location is meant.

 

Would all the other elements of the path stay the same would they need to change as well? You ask about . but what about the \php\? Will the new location have that folder? Other folders appearing in other paths?

 

Are the programs all in the same location? A few locations? Scattered nearly randomly across multiple physical locations?

 

There are potential time issues with some solutions to the "how many" question. If it takes a few hours to debug and verify an the values it is likely not worth the effort for just a few files but may be if there are hundreds involved.

If the paths may have to change frequently then a likely approach would be to replace the . with a macro variable that could be set before running the programs. However you would also have to make the path inside double quotes for the macro variable to resolve.

 

If an approach has to search just to find the files that is another set of things to be resolved.

 

If the scrip locations are nice the source text is no worse than you show then perhaps a SED script would be sufficient, no SAS involved needed at all for text replacement.

View solution in original post

1 REPLY 1
ballardw
Super User

How many programs do you expect to modify?

 

With that first "directory" have to change again? Note, Paths for files really should start at a drive, or in the case of a url a server, so there is no ambiguity as to what location is meant.

 

Would all the other elements of the path stay the same would they need to change as well? You ask about . but what about the \php\? Will the new location have that folder? Other folders appearing in other paths?

 

Are the programs all in the same location? A few locations? Scattered nearly randomly across multiple physical locations?

 

There are potential time issues with some solutions to the "how many" question. If it takes a few hours to debug and verify an the values it is likely not worth the effort for just a few files but may be if there are hundreds involved.

If the paths may have to change frequently then a likely approach would be to replace the . with a macro variable that could be set before running the programs. However you would also have to make the path inside double quotes for the macro variable to resolve.

 

If an approach has to search just to find the files that is another set of things to be resolved.

 

If the scrip locations are nice the source text is no worse than you show then perhaps a SED script would be sufficient, no SAS involved needed at all for text replacement.

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!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 149 views
  • 0 likes
  • 2 in conversation