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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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