Help using Base SAS procedures

file extension change

Reply
Occasional Contributor
Posts: 10

file extension change

Hi Everyone

I am working on SAS enterprise Guide in WINDOWS XP environment.

As part of my automation work, I need to convert some of the excel files (.xls, .xlsx) to .csv files due to some issues in handling .xls and .xlsx files directly.

Do you know any way in SAS using which I can convert file in one extension to another - of course as per the operating environment which in my case is XP?

Appreciate your co-operation.

Thanks
Shankar
Super User
Posts: 9,662

Re: file extension change

That is easy.Assuming all your xls file in c:\temp
[pre]



filename csv pipe 'dir c:\temp\*.xls* /b';
data _null_;
file 'c:\rename.bat';
infile csv length=len;
input name $varying100. len;
str='rename '||strip(name)||' '||strip(scan(name,1,'.'))||'.csv';
put str;
run;
x 'c:\rename.bat';
x 'del c:\rename.bat';
run;
[/pre]

Ksharp
Contributor
Posts: 35

Re: file extension change

That is just going to rename them, not convert them.
Super User
Posts: 9,662

Re: file extension change

Maybe you need to use Google to search some software which can convert xls into csv automatically.

Ksharp
Ask a Question
Discussion stats
  • 3 replies
  • 178 views
  • 0 likes
  • 3 in conversation