BookmarkSubscribeRSS Feed
Ujjawal
Quartz | Level 8

I am trying to spice up the table format with PROC TEMPLATE.

 

 

proc template;
define style mystyle;
/* Body */
 class body / 
 backgroundcolor = white
 color = black ;
 /* Tables */
 class table /
 frame = box
 rules = all
 borderwidth = 1px
 borderstyle = solid
 bordercolor = #5D5D5D
 borderspacing = 0
 bordercollapse = collapse
 cellpadding = 5px;
 class data, header, rowheader /
 fontfamily = '"Lucida Grande", Arial, sans-serif'
 fontsize = 11pt
 backgroundcolor = #FFF
 color = black;
 class header, rowheader /
 fontweight = medium
 textalign = left
 fontsize = 12pt
 backgroundcolor = #1F1C7C
 color = #FFF;
 /* System Title and Footers */
 class systemtitle, systemfooter /
 fontfamily = '"Lucida Grande", Arial, sans-serif';
 /* Page number and date (for printer) */
 class pageno, bodydate /
 fontfamily = '"Lucida Grande", Arial, sans-serif' ;
end;
run;

ods html style=mystyle file = 'C:\Users\Ujjawal\Downloads\temp.htm';
proc print data=sashelp.class noobs;
run;
ods _all_ close;

The above code works fine if i use ODS HTML. But i need to create multi-sheet excel file. So i am using ODS TAGSETS EXCELXP. It does not work with ODS TAGSETS EXCELXP.

 

ods tagsets.excelxp file='C:\Users\Ujjawal\Documents\multii.xls' style=mystyle
options(sheet_name='Summary' skip_space='1,0,0,0,1' EMBEDDED_TITLES='yes' sheet_interval='none' suppress_bylines='no');
proc print data=sashelp.class noobs;
run;
ods tagsets.excelxp close;

What i am doing using PROC TEMPLATE - Making background color of header BLUE (#1F1C7C) and background color of border LIGHT BLACK (#5D5D5D) .

3 REPLIES 3
amadhavi41
Fluorite | Level 6

What is the issue/error you are getting?

Reeza
Super User

I would grab a template I know that works and change that to see if I could get it working. 

 

I know proc report allows you to customize formatting for tagsets so you do have work around options. 

Cynthia_sas
SAS Super FREQ
Hi: I would expect you to get an error message when you try to open the Excel file -- I believe you have your quoting wrong in the FONTFAMILY attribute.
When I try a version of your template with this:
fontfamily = '"Times New Roman", Arial, sans-serif';
(because I don't have Lucida Grande on my system), I get an error message from Excel.

But, if I have this:
fontfamily = 'Times New Roman, Arial, sans-serif' ;
then I don't have an error message from Excel.

Also, aside from the sheet_interval='none' issue, typically, I find border colors, border styles and border widths generally ignored by Excel, So I believe you can simplify your template.

Also, if you plan to share your template with other people, then you will generally need to write the template to an item store on a shared drive or server where other folks can get to it.

cynthia

Also, with sheet_interval='none' you are telling TAGSETS.EXCELXP that you do NOT want a multi-sheet workbook, but that you want ALL your procedure output in one worksheet.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3 replies
  • 1256 views
  • 0 likes
  • 4 in conversation