BookmarkSubscribeRSS Feed
mnjtrana
Pyrite | Level 9

Hi ALL,

 

I am trying to rename one filr in my sas program using the X command. The file name contains some speical character and spaces?

However the file is not getting renamed. I am using SAs 9;.4

 

options noxwait;
X "RENAME e:\data\Playground\Manjeet\SAS_EG\Bank42\Gamt - trivækst - 2011.egp F345.egp";

I also tried, but no luck. Can any one suggest any other idea to rename the file.

 

X 'RENAME "e:\data\Playground\Manjeet\SAS_EG\Bank42\Gamt - trivækst - 2011.egp" "F345.egp"';

 

Thanks in advance!

 

Manjeet


Cheers from India!

Manjeet
5 REPLIES 5
DanielSantos
Barite | Level 11

Hi.

 

I've tried to simulate the problem here with a dummy file.

 

X 'RENAME "D:\Temp\Gamt - trivækst - 2011.egp" "F345.egp"';

 

does work as supposed (Windows 😎

 

Is the path/file name correct?

 

Daniel Santos @ www.cgd.pt

Kurt_Bremser
Super User

Are you sure that the SAS process runs in the same context in which Enterprise Guide is running (local SAS, same user)?

 

To verify that, I'd run

filename oscmd pipe 'dir e:\data\Playground\Manjeet\SAS_EG\Bank42 2>&1';

data _null_;
infile oscmd;
input;
put _infile_;
run;

and look at the log.

mnjtrana
Pyrite | Level 9

I didn't actually got what you mant by the context.

 

I ran the code and i am seeing the file in log as:

 

09/06/2011  16:21            77,974 Garant - tilv‘kst - 2011.egp

 

Howver the actual file name was:

Gamt - trivækst - 2011.egp

Its different, Please suggest what to do. 


Cheers from India!

Manjeet
Kurt_Bremser
Super User

Since this is on Windows, I suggest using the proper Windows tool (Explorer) to get rid of the non-ASCII characters.

And make it mandatory policy that filenames must not contain non-ASCII characters or blanks.

 

ballardw
Super User

If you are running in a server environment then the path used may be interpretted by the SAS Server as relative to that machine and not looking at your harddrive at all.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 5 replies
  • 10335 views
  • 0 likes
  • 4 in conversation