BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djrisks
Barite | Level 11

Hello,

 

I'm trying to use the rename function (in SAS 9.4) to rename a file, however it appears that because I'm using a forward slash in the new filename, that the rename function will not work. Do you know how I can achieve a forward slash in the new filename please?

 

This is the code that I've been trying to use.

 

data _null_;
  rc=rename("S:\SEP380-201_201_201201001_EoT_999_ET_SIGMA Past Week_std_260123_Feedback.pdf", "S:\SEP380-201_201_201201001_EoT/ET_SIGMA Past Week_std_260123_Feedback.pdf", 'file');
run;

 

Many thanks,

 

Kriss

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Windows does not allow forward slash in file names.

View solution in original post

4 REPLIES 4
Reeza
Super User
Windows does not allow forward slash in file names.
djrisks
Barite | Level 11
Thank you for confirming, at first I thought that I may need to escape the forward slash.
Tom
Super User Tom
Super User

I don't think you can get SAS to do something that the underlying operating system doesn't support.

C:\downloads>echo "hello" > test1.txt

C:\downloads>rename test1.txt "test1/2.txt"
The system cannot find the path specified.

C:\downloads>
djrisks
Barite | Level 11
Thanks for the confimation.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1284 views
  • 2 likes
  • 3 in conversation