options noxsync noxwait;
/* reference the tagset from support.sas.com */
Filename tpl url
"http://support.sas.com/rnd/base/ods/odsmarkup/tableeditor/tableeditor.tpl";
/* insert the tagset into the search path for ODS templates */
Ods path(Prepend) work.templat(update);
%include tpl;
ods tagsets.tableeditor file="C:\**\temp.html"
options(addfield="Calc1 = value1/value5"
auto_excel="yes"
excel_open="yes"
sheet_name="Data"
pivot_sheet_name="sheetname"
pivotdata="value1, value2, value3, value4, value5, Calc1"
pivotdata_caption="Value 1, Value 2, Value 3, Value 4, Value 5, Calculation 1"
pivotdata_stats="sum, sum, sum, sum, sum, sum"
pivotrow="category1, category2"
pivot_format="light1"
pivotdata_toColumns="yes"
pivotdata_fmt="#,##0~ #,##0~ #,##0~ #,##0~ #,##0~0.00%"
)
;
proc print data=sumtable1; run;
ods tagsets.tableeditor close;
After running this code, I receive an error:
Unable to get PivotFields property of Pivot Table class
Please advise.
Make sure that the table header names in the source worksheet and HTML table match the fields Value1-Value5 that you have included with the PivotData= option. For instance, make sure that you don't have them displayed with labels and use the actual column names in the option. The table headers should match the values specified in the Pivotdata= option.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.