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

In going from SAS (Proc Tabulate) to Excel (via ODS), whenever there is a ".0" (from tabulate) it is lost in Excel.

Example: "2.0" from tabulate is shown as "2.0" in the excel table, but is actually shown as "2" in the formula bar and in subsequent formula bar output. Anything other than ".0" is OK. Thought I had a workaround for this. Thanks so much.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
You probably need to use TAGATTR style options then.
See Page 9 here:
https://support.sas.com/resources/papers/proceedings17/1482-2017.pdf

You'll need to find the correct format for Excel though, their example is slightly different but the syntax is the same.

View solution in original post

6 REPLIES 6
Reeza
Super User
Show your code. Which ODS?
wcw2
Obsidian | Level 7

ods excel file='......xlsx';
OPTIONS orientation=landscape nodate;
proc tabulate data=s31cm.cm_coded_post_s format=10. S=[foreground=black just=c] out=post_table;
class level4 medpnt arm; keylabel N=' ';
table level4=''*(medpnt='') all='Overall',
arm=''*(n='' colpctn=''*f=8.1 )
(n='' colpctn=''*f=8.1 )/misstext='0';
where level4 in ('OTHER ANTIHISTAMINES FOR SYSTEMIC USE, R06AX' 'PROTON PUMP INHIBITORS, A02BC');
run;
ods excel close;

Reeza
Super User
You probably need to use TAGATTR style options then.
See Page 9 here:
https://support.sas.com/resources/papers/proceedings17/1482-2017.pdf

You'll need to find the correct format for Excel though, their example is slightly different but the syntax is the same.
ballardw
Super User

Since "2" and "2.0" calculate exactly the same I would not worry about differences in the "formula" bar of Excel. It does the same thing when you manually enter data.

wcw2
Obsidian | Level 7

this is for a table to present....here's 2 columns in Excel, counts and percentages (1 decimal place).....there needs to be a ".0" added for the 2 and 100 percentage values

Arm 1: 2RHZE/4RH
00
23.9
59.8
12
1427.5
713.7
1529.4
611.8
12
51100

 

 

 

 

Reeza
Super User
The issue is from Excel side, it autoformats the data. Either way, using TAGATTR as I suggested will resolve the issue.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Health and Life Sciences Learning

 

Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.

LEARN MORE

Discussion stats
  • 6 replies
  • 1635 views
  • 1 like
  • 3 in conversation