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.

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 813 views
  • 0 likes
  • 2 in conversation