BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
alepage
Barite | Level 11

Hello,

 

I would like to know  if there is a sample way to preserve the dataset format while exporting the output results from SAS to an xlsx file.

Please note that I am using proc export.

 

%macro Export2;
proc export
data=Final
dbms=xlsx
outfile="\\iagsrvfic01\report.xlsx"
replace;
sheet=Rate;
run;
%mend Export2;

%Export2;

 

I have tried ODS Tagset.ExcelXP but I received an error message due to the Excel format file (xlsx instead of xls)

ODS Tagset.ExcelXP file="\\iagsrvfic01\report.xlsx" ;

PROC PRINT DATA=Final;
VAR var1 var2 var3;
VAR var4 var5 / style={TAGATTR='format:0.00'};
RUN;
ODS tagsets.ExcelXP CLOSE;

 

Regards,

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

No, proc export is a basic dump of the data. 

Use ods tagsets.excelxp, which can create nice outputs.  The thing you get is not an error, it is a warning from Excel.  It is telling you that the file you have - the output from the tagsets - is XML, yet you have given it the file extension XLSX.  So Excel is telling you that this does not match.  It is again, not an error, its it perfectly understandable.  Call the output file xml, and then open it with Excel (not double click on it which will defaut to opening with browser).  The file extension is important, and this tells programs what the file is.

 

Or use the newer one ods excel:

http://documentation.sas.com/?docsetId=odsug&docsetTarget=p09n5pw9ol0897n1qe04zeur27rv.htm&docsetVer...

Which creates actual xlsx files, but you have to have a recent SAS version.

 

 

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

No, proc export is a basic dump of the data. 

Use ods tagsets.excelxp, which can create nice outputs.  The thing you get is not an error, it is a warning from Excel.  It is telling you that the file you have - the output from the tagsets - is XML, yet you have given it the file extension XLSX.  So Excel is telling you that this does not match.  It is again, not an error, its it perfectly understandable.  Call the output file xml, and then open it with Excel (not double click on it which will defaut to opening with browser).  The file extension is important, and this tells programs what the file is.

 

Or use the newer one ods excel:

http://documentation.sas.com/?docsetId=odsug&docsetTarget=p09n5pw9ol0897n1qe04zeur27rv.htm&docsetVer...

Which creates actual xlsx files, but you have to have a recent SAS version.

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 1464 views
  • 0 likes
  • 2 in conversation