DATA Step, Macro, Functions and more

FILENAME PIPE & X commands

Reply
Contributor
Posts: 52

FILENAME PIPE & X commands

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
Super Contributor
Posts: 474

Re: FILENAME PIPE & X commands

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 8)

 

Is the path/file name correct?

 

Daniel Santos @ www.cgd.pt

Super User
Posts: 6,936

Re: FILENAME PIPE & X commands

[ Edited ]

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 52

Re: FILENAME PIPE & X commands

[ Edited ]

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
Super User
Posts: 6,936

Re: FILENAME PIPE & X commands

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.

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 10,500

Re: FILENAME PIPE & X commands

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.

 

Ask a Question
Discussion stats
  • 5 replies
  • 147 views
  • 0 likes
  • 4 in conversation