The SAS Output Delivery System and reporting techniques

proc tabulate (to excel via ods) Fonts not applying corectly

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

proc tabulate (to excel via ods) Fonts not applying corectly

My Excel is set up with Times New Roman 12pt as the default font. When I run the following program,  the CLASS Variable values are displayed with the Arial 12 PT font when I open the output in excel.  Also, the Degree variable values are centered and not left adjusted. Any ideas on why the Arial font is being applied or why the Degree var values are being centered?  It does not take much to edit it, but it is annoying. 

Thanks in advance,

Charlie


%LET STY1=FONT_FACE="TIMES_NEW_ROMAN"  FONT_SIZE=12PT  FOREGROUND=BLACK just=left cellwidth=1.5

%LET STY2= FONT_FACE="TIMES_NEW_ROMAN"  FONT_SIZE=12PT  FOREGROUND=MAROON just=left cellwidth=1.5;

HTML FILE='C:\PROG EVAL 2014\REPORTS\PRELIM GFU-MTC-TRF-DEW REPORT.XLS';

"<td align=center colspan=9><font TIMES_NEW_ROMAN size=12PT><b> Interim Results for the SCTCS Academic Program Evaluation of the 2012-2013 Graduate Placement </b></font></td>";

"<td align=center colspan=9><font TIMES_NEW_ROMAN size=12PT><b> based on the Graduate Survey, National Clearing House, and SC Employment Data </b></font></td>";

TABULATE DATA=DEWYX MISSING STYLE=[&STY1] ;

CLASS DEPT DEGREE DEGTITLE/style=[&STY1] ; VAR GRAD IN_FIELD SCHOOL RESP EXCLUDE  PLACED ADJTOT/STYLE=[&STY1];

TABLE (DEPT=' '*DEGREE=' '*DEGTITLE=' ' ALL='TOTAL'*F=6.0)*[STYLE=[&STY1] ], ((GRAD='Grads' In_Field  School  Placed Resp)*[STYLE=[&STY2]]*F=6.0 'Placed %'*((PCTSUM<adjtot>)*f=pctPIC.)*[style=[FONT_FACE="TIMES_NEW_ROMAN"  FONT_SIZE=12PT  foreground=traffic.]]) ;

KEYLABEL SUM=' ';

KEY LABEL PCTSUM=' ';

RUN;

HTML CLOSE;


Accepted Solutions
Solution
‎07-01-2014 09:59 PM
SAS Super FREQ
Posts: 8,721

Re: proc tabulate (to excel via ods) Fonts not applying corectly

Hi, it looks like some of your statements got truncated or chopped off on the left-hand side? Can you repost the code?

  Just as an aside, on my system the name of the font is NOT TIMES_NEW_ROMAN -- if you specify a font that is not found, then the default Microsoft font is used. On my system, the name of the font is "Times New Roman" -- mixed case, with spaces. Is the name of the font on your system actually TIMES_NEW_ROMAN???

Also, you seem to be missing a semi-colon after your first %LET statement.

cynthia

You were also missing a CLASSLEV statement and a unit of measure after your CELLWIDTH (I don't think you mean 1.5 pixels). And, you needed a KEYWORD statement to apply style to the other values, like TOTAL, etc. Since you did not post your formats or any data, I ran this test with SASHELP.PRDSALE. This code worked for me. I used ODS MSOFFICE2K because Excel is notorious for NOT liking the type of style that is specified in "regular" ODS HTML (which creates HTML 4.0 tags), so I always use ODS MSOFFICE2K, which creates Microsoft "flavor" of HTML.


%LET STY1=FONT_FACE="Times New Roman"  FONT_SIZE=12PT  FOREGROUND=BLACK just=left cellwidth=1.5in;
%LET STY2= FONT_FACE="Times New Roman"  FONT_SIZE=12PT  FOREGROUND=MAROON just=left cellwidth=1.5in;
  
ods _all_ close;
ODS msoffice2k FILE='C:\temp\times_REPORT.XLS' style=sasweb;
 
title1 f="Times New Roman" h=12pt bold "Interim Results for the SCTCS Academic Program Evaluation of the 2012-2013 Graduate Placement";
title2 f="Times New Roman" h=12pt bold "based on the Graduate Survey, National Clearing House, and SC Employment Data";
 
PROC TABULATE DATA=sashelp.prdsale MISSING STYLE=[&STY1] ;
  CLASS region country prodtype/style=[&STY1] ;
  CLASSLEV region country prodtype / style=[&STY1];
  VAR actual predict /STYLE=[&STY1];

  TABLE  (country=' '*region=' '*prodtype=' ' ALL='TOTAL'*F=6.0)*[STYLE=[&STY1] ],
         (actual predict)*(sum mean max min )*[STYLE=[&STY2]]*F=6.0  ;
  KEYWORD ALL SUM MEAN MIN MAX / style=[&sty1];
RUN;
 
ODS msoffice2k CLOSE;

View solution in original post


All Replies
Solution
‎07-01-2014 09:59 PM
SAS Super FREQ
Posts: 8,721

Re: proc tabulate (to excel via ods) Fonts not applying corectly

Hi, it looks like some of your statements got truncated or chopped off on the left-hand side? Can you repost the code?

  Just as an aside, on my system the name of the font is NOT TIMES_NEW_ROMAN -- if you specify a font that is not found, then the default Microsoft font is used. On my system, the name of the font is "Times New Roman" -- mixed case, with spaces. Is the name of the font on your system actually TIMES_NEW_ROMAN???

Also, you seem to be missing a semi-colon after your first %LET statement.

cynthia

You were also missing a CLASSLEV statement and a unit of measure after your CELLWIDTH (I don't think you mean 1.5 pixels). And, you needed a KEYWORD statement to apply style to the other values, like TOTAL, etc. Since you did not post your formats or any data, I ran this test with SASHELP.PRDSALE. This code worked for me. I used ODS MSOFFICE2K because Excel is notorious for NOT liking the type of style that is specified in "regular" ODS HTML (which creates HTML 4.0 tags), so I always use ODS MSOFFICE2K, which creates Microsoft "flavor" of HTML.


%LET STY1=FONT_FACE="Times New Roman"  FONT_SIZE=12PT  FOREGROUND=BLACK just=left cellwidth=1.5in;
%LET STY2= FONT_FACE="Times New Roman"  FONT_SIZE=12PT  FOREGROUND=MAROON just=left cellwidth=1.5in;
  
ods _all_ close;
ODS msoffice2k FILE='C:\temp\times_REPORT.XLS' style=sasweb;
 
title1 f="Times New Roman" h=12pt bold "Interim Results for the SCTCS Academic Program Evaluation of the 2012-2013 Graduate Placement";
title2 f="Times New Roman" h=12pt bold "based on the Graduate Survey, National Clearing House, and SC Employment Data";
 
PROC TABULATE DATA=sashelp.prdsale MISSING STYLE=[&STY1] ;
  CLASS region country prodtype/style=[&STY1] ;
  CLASSLEV region country prodtype / style=[&STY1];
  VAR actual predict /STYLE=[&STY1];

  TABLE  (country=' '*region=' '*prodtype=' ' ALL='TOTAL'*F=6.0)*[STYLE=[&STY1] ],
         (actual predict)*(sum mean max min )*[STYLE=[&STY2]]*F=6.0  ;
  KEYWORD ALL SUM MEAN MIN MAX / style=[&sty1];
RUN;
 
ODS msoffice2k CLOSE;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 324 views
  • 0 likes
  • 2 in conversation