Hi all, I am trying to output a docx file using SAS. I was having some issues with formatting using RTF so I wanted to give docx a try. I am using SAS 9.4 TS1M6 in which ODS word is in preproduction. When I try to open the outputted docx, I am getting the error you see below. I have attached some sample code to mimic what I am doing, but it is really not all too complicated. I also provided the link to a paper I was using on the subject. Anyone have an idea how to prevent this error? For what it is worth, when I output this using ODS RTF and .RTF (instead of .docx) it works just fine. data mydata;
input var1 $ var2 $ var3 $ var4 $;
datalines;
18-24 10.00% .5 1
25-34 10.00% .5 1
35-44 10.00% .5 1
45-54 10.00% .5 1
55-64 10.00% .5 1
;
ods escapechar="^";
%Let year_range=Jan 2018 – Dec 2018;
proc format;
value $ sym
'1' = '^{unicode 2713}';
run;
%macro hex2(n);
%local digits n1 n2;
%let digits = 0123456789ABCDEF;
%let n1 = %substr(&digits, &n / 16 + 1, 1);
%let n2 = %substr(&digits, &n - &n / 16 * 16 + 1, 1);
&n1&n2
%mend hex2;
/* convert RGB triplet (r,g,b) to SAS color in hexadecimal.
The r, g, and b parameters are integers in the range 0--255 */
%macro RGB(r,g,b);
%cmpres(CX%hex2(&r)%hex2(&g)%hex2(&b))
%mend RGB;
ODS word file="locationhere\name.docx";
proc report data=mydata split='*' style(hdr)=[foreground = Black background=%RGB(126,172,147) font_size=2.5 font_face=Arial verticalalign=m height=.52in just=c] spanrows
style(column)=[font_size=1.8 font_face=Arial height=.35in verticalalign=m background=%RGB(255,255,255)];
define var1 / display 'Var1' style=[cellwidth=2.1in];
define var2 / display "Var2* &year_range" style=[cellwidth=1.5in just=c];
define var3 / display 'Var3' style=[cellwidth=1.5in just=c];
define var4 / display 'Var4' style(column)=[just=c font_size=4 cellwidth=1.4in verticalalign=m font_face=Arial];
format var4 $sym.;
run;
ODS word CLOSE; https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3235-2019.pdf
... View more