SAS Programming

DATA Step, Macro, Functions and more
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 11232 views
  • 0 likes
  • 4 in conversation