DATA Step, Macro, Functions and more

ods tagsets.excelxp

Reply
Contributor
Posts: 62

ods tagsets.excelxp

Using ods tagsets.excelxp cut values to a certain number of digits. Did someone know why ?

 

Regards

Contributor
Posts: 62

Re: ods tagsets.excelxp

Like in this example

 

data have;
input a b;
cards;
2.123456789  3.123456789
;run;

ods tagsets.excelxp file= "&folder\have.xls" options(sheet_name= "have") style= SasDocPrinter ;
proc print data=have noobs label;
run;
ods tagsets.excelxp close;

:

 

Super User
Posts: 7,854

Re: ods tagsets.excelxp

First of all, don't lie with filenames. You are creating Excel-compatible XML, so the file should have an extension of .xml.

 

And keep in mind that ODS is for printed, user-readable, reporting-style output; therefore it respects the formats of variables.

Assign a proper format:

data have;
input a b;
format a b best32.;
cards;
2.123456789  3.123456789
;
run;

and you will see that all decimals end up in Excel.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Community Manager
Posts: 2,955

Re: ods tagsets.excelxp

Posted in reply to KurtBremser

If using SAS 9.4 or later, use ODS EXCEL in place of ODS tagsets.EXCELXP -- this will create a native XLSX file for you.  You'll still need to apply the number format as @KurtBremser suggests.

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