Can i know how to convert excel files to xpt files. We have got some internal requirement. Thank you. There are few excel files with multiple tabs, and there is a limitation of SAS in our organisation that we will not be able to import excel files, we have only privilege to import csv files. can i know a best solution for this.
Hello
You have few excel files and you cannot import them using SAS.
Then one approach would be save the excel sheets individually as csv and follow your solution.
You have other option of using tools like python or R and convert your files to csv and then follow your solution.
That's probably a licensing issue but I thought XLSX libname support had moved to Base...you can get VBS scripts to convert workbooks and all sheets to CSV assuming they're well formed. If they're not, you may need Excel macros or some other method to convert those to CSV. Lots of solutions online for this approach..assuming you're on Windows and can run VBS.
As the final xpt files need to be sent to client and they are requesting us to use only SAS for this, is there any solution for this apart from vba script or groupdocs.
Hello @Ravindra_
You have put forth the following two constraints in your posts
(1)There is a limitation of SAS in our organisation that we will not be able to import excel files
(2)As the final xpt files need to be sent to client and they are requesting us to use only SAS for this.
The plausible approach would be to export the excel to csv (preferably from excel itself) and then use SAS to import the data (csv file) and then create a transport file(xpt). This approach will satisfy both of your constraints.
In my view the suggestion by @Reeza needs to be considered. That simplifies the entire process. You may need to convince the decision makers in your company to implement this suggestion.
Oh. you could issue OS command to execute Reeza's VBA in SAS .
Like:
x 'your os command here to execute vba' ;
filename x pipe 'your os command here to execute vba';
data _null_;
call system('your os command here to execute vba');
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.