BookmarkSubscribeRSS Feed
DoumbiaS
Quartz | Level 8

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

 

Regards

3 REPLIES 3
DoumbiaS
Quartz | Level 8

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;

:

 

Kurt_Bremser
Super User

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.

ChrisHemedinger
Community Manager

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 @Kurt_Bremser suggests.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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!

How to Concatenate Values

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.

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
  • 3 replies
  • 918 views
  • 0 likes
  • 3 in conversation