1 min read

Order Matters: A Weird Behavior of SAS ODS Style Options

The codes to push a dataset to Excel (technically XML):

ods tagsets.excelxp file=“test.xls”;
 
*#1;
ods tagsets.excelxp options( sheet_name=’test 1′);
proc print data=sashelp.class noobs;
    var height / style={tagattr=’format:text’} style(column)={cellwidth=.5 in};
run;

*#2; 
ods tagsets.excelxp options( sheet_name=’test 2′);
proc print data=sashelp.class noobs;
    var height / style(column)={cellwidth=.5 in} style={tagattr=’format:text’} ;
run;
 
ods tagsets.excelxp close;

The output of #1:SAS_ODS_options1

#2:SAS_ODS_options2

The difference among the two pieces of code, #1 and #2 is trivial, as far as observed: only the position of the ODS style options was swapped. The weird thing is that they produced different outputs with different column width and cell format.

The answer: I don’t know. I threw this question to SAS-L and SAS tech and we might come back to this question days later.