BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
madhatter
Calcite | Level 5

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

1 REPLY 1
Cynthia_sas
SAS Super FREQ

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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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