- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use ods excel to output a sas data set to excel while at the same time adding a computed column as an excel formula. The data set exports to excel just fine but the computed column just has periods (.) as values....no formula. I have tried absolutely everything and nothing seems to work...as if SAS is completely ignoring the tagattr altogether. I am well aware I could just do this calculation in SAS then export the resolved value, this is just an example that I am playing with to eventually scale up to a larger program that must export excel formulas to excel and not be calculated by SAS.
ods excel file="C:\temp.xlsx";
data _null_; set sashelp.class end=done; if _n_ = 1 then do; declare odsout t(); t.table_start(); t.row_start(); t.format_cell(data: 'Name'); t.format_cell(data: 'Height (ins)'); t.format_cell(data: 'Weight (lbs)'); t.format_cell(data: 'derived'); t.row_end(); end; t.row_start(); t.format_cell(data: name); t.format_cell(data: height); t.format_cell(data: weight); t.format_cell(data: .,style_attr: 'tagattr="formula:RC[-1]-RC[-2]"'); t.row_end(); if done then t.table_end(); run; ods excel close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I copied your program and ran it and it looks to be working correctly to me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What version of SAS are you using?
Make sure the formula option is on, explicitly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
using SAS9.4M4.
I get no warnings or errors in the SAS log
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
When I run your code in 9.4 M6, this is what I get:
It looks like the formula is being put into the cell. You might want to work with Tech Support on this question if this doesn't work for you in 9.4 M6.
Cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
And works for Libre Office Calc.
Perhaps you can share the LOG you get when there are no results in the calculated column?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@mj007 wrote:
I am thinking this might be the issue...I am only on SAS 9.4M4.
That's the version I ran successfully.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content