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

How do I get borders on the following example table using the SASdocPrinter style and ODS EXCEL?

%MACRO Brdr_clr_wdth(c,w);
  bordertopcolor=&c    bordertopwidth=&w
  borderbottomcolor=&c borderbottomwidth=&w
  borderleftcolor=&c   borderleftwidth=&w
  borderrightcolor=&c  borderrightwidth=&w
%MEND;

ODS Excel(CARS) 
  File="%sysfunc(pathname(work,L))\Temp_cars.xlsx"
  style=SasDocPrinter;

  proc print data=sashelp.CARS(obs=2) NoObs label 
    style(HEADER)=[font_weight=bold %Brdr_clr_wdth(black,1) ] 
    style(TABLE)=[                  %Brdr_clr_wdth(black,1) ] 
    ;
    VAR Model	MSRP;
  run;

ODS Excel(CARS) close;
1 ACCEPTED SOLUTION

Accepted Solutions
PhilC
Rhodochrosite | Level 12

Thanks @Cynthia_sas,

I also knew that I could redefine a style.  An earlier attempt left me fruitless and frustrated -- on many levels.  This time I pushed through and made myself a "HTMLBW" style.  I'm still frustrated because (disclaimer) I know its just a hack and I have no clue if and when I use it that it will randomly fail on me and force me to tweak something. I'm going to share it here, just incase someone might find useful.

 

Styles.HTMLBW:

proc template;                                                                
   define style Styles.HTMLBW;                                              
      parent = styles.statistical;  
      class fonts                                                             
         "Fonts used in the default style" /                                  
         'TitleFont2' = ("<sans-serif>, Helvetica, sans-serif",4) 
         'TitleFont' = ("<sans-serif>, Helvetica, sans-serif",5);
      class GraphColors /                                                     
         'gndata12' = cxECE8C4                                                
         'gndata11' = cxDBD8F8                                                
         'gndata10' = cxC6E4BF                                                
         'gndata9' = cxE6CEAD                                                 
         'gndata8' = cxE5C1D4                                                 
         'gndata7' = cxCCDFF0                                                 
         'gndata6' = cxDDDEB5                                                 
         'gndata5' = cxDBC7E7                                                 
         'gndata4' = cxD5C6B4                                                 
         'gndata3' = cxB7D4D3                                                 
         'gndata2' = cxE7B3B4                                                 
         'gndata1' = cxBBC2DC                                                 
         'gndata' = cxBBC2DC                                                  
         'gofill' = cxFFFFFF                                                  
         'gout2cend' = cx919191                                               
         'gout2cstart' = cxe9e9e9                                             
         'gblockheader' = cxcfd5de                                            
         'gcphasebox' = cx989EA1                                              
         'gphasebox' = cxDBE6F2                                               
         'gczonec' = cxBECEE0                                                 
         'gzonec' = cxCCDCEE                                                  
         'gczoneb' = cxCCDCEE                                                 
         'gzoneb' = cxD7E5F3                                                  
         'gzonea' = cxE3EDF7                                                  
         'gconramp3cend' = cx9C1C00                                           
         'gconramp3cneutral' = cx222222                                       
         'gconramp3cstart' = cx0E36AC                                         
         'gramp3cend' = cxD05B5B                                              
         'gramp3cneutral' = cxFFFFFF                                          
         'gramp3cstart' = cx667FA2                                            
         'gcontrollim' = cxE6F2FF                                             
         'gccontrollim' = cxBFC7D9                                            
         'gruntest' = cxCAE3FF                                                
         'gcruntest' = cxBF4D4D                                               
         'gclipping' = cxFFFFC6                                               
         'gcclipping' = cxC1C100                                              
         'gaxis' = cx989EA1                                                   
         'greferencelines' = cx989EA1;                                        
      class colors /                                                          
         'link2' = cx0000FF                                                   
         'link1' = cx800080                                                   
         'docbg' = cxFFFFFF                                                   
         'contentbg' = cxFFFFFF                                               
         'systitlebg' = cxFFFFFF                                              
         'titlebg' = cxFFFFFF                                                 
         'proctitlebg' = cxFFFFFF                                             
         'headerbg' = cxEDF2F9                                                
         'captionbg' = cxFFFFFF                                               
         'captionfg' = cx000000                                               
         'bylinebg' = cxFFFFFF                                                
         'notebg' = cxFFFFFF                                                  
         'tablebg' = cxFFFFFF                                                 
         'batchbg' = cxFFFFFF                                                 
         'systitlefg' = cx000000                                              
         'titlefg' = cx000000                                                 
         'proctitlefg' = cx000000                                             
         'bylinefg' = cx000000                                                
         'notefg' = cx000000;                                                 
      class Header /                                                          
         bordercolor = cx000000                                    
         backgroundcolor = cxFFFFFF                                  
         color = cx000000;                                                    
      class Footer /                                                          
         bordercolor = cx000000                                    
         backgroundcolor = cxFFFFFF                                  
         color = cx000000;                                                    
      class RowHeader /                                                       
         bordercolor = cx000000                                    
         backgroundcolor = cxFFFFFF                                  
         color = cx000000;                                                    
      class RowFooter /                                                       
         bordercolor = cx000000                                    
         backgroundcolor = cxFFFFFF                                  
         color = cx000000;                                                    
      class Table /                                                           
         bordertopwidth = 1px                                                 
         borderleftwidth = 1px                                                
         borderbottomwidth = 1px                                              
         borderrightwidth = 1px                                               
         bordercolor = cx000000                                               
         cellpadding = 5;                                                     
      style Data /                                                            
         font = fonts('DocFont')                                              
         backgroundcolor = cxFFFFFF                                           
         bordercolor = cx000000                                               
         bordertopwidth = 1px                                                 
         borderleftwidth = 1px                                                
         borderbottomwidth = 1px                                              
         borderrightwidth = 1px                                               
         borderstyle = solid;                                                 
      class Graph /                                                           
         attrpriority = "Color";                                              
      class GraphFit2 /                                                       
         linestyle = 1;                                                       
      class GraphClipping /                                                   
         markersymbol = "circlefilled";                                       
      class Link /                                                            
         color = colors('link2');                                             
      class VisitedLink /                                                     
         color = colors('link1');                                             
      class ActiveLink /                                                      
         color = colors('link1');                                             
   end;                                                                       
run;

 

 

View solution in original post

3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
Take a look at this paper https://support.sas.com/resources/papers/proceedings16/SAS5642-2016.pdf which describes that TAGSETS.EXCELXP and ODS EXCEL use different values for setting border width (page 18-19) -- plus it also looks like the destinations use different background values so the lines will show.

Also note that SASDOCPRINTER was initially a style written for the PDF and other Printer-family destinations, so it may not work as well as starting from HTMLBLUE.

Cynthia
PhilC
Rhodochrosite | Level 12

Thanks @Cynthia_sas,

I also knew that I could redefine a style.  An earlier attempt left me fruitless and frustrated -- on many levels.  This time I pushed through and made myself a "HTMLBW" style.  I'm still frustrated because (disclaimer) I know its just a hack and I have no clue if and when I use it that it will randomly fail on me and force me to tweak something. I'm going to share it here, just incase someone might find useful.

 

Styles.HTMLBW:

proc template;                                                                
   define style Styles.HTMLBW;                                              
      parent = styles.statistical;  
      class fonts                                                             
         "Fonts used in the default style" /                                  
         'TitleFont2' = ("<sans-serif>, Helvetica, sans-serif",4) 
         'TitleFont' = ("<sans-serif>, Helvetica, sans-serif",5);
      class GraphColors /                                                     
         'gndata12' = cxECE8C4                                                
         'gndata11' = cxDBD8F8                                                
         'gndata10' = cxC6E4BF                                                
         'gndata9' = cxE6CEAD                                                 
         'gndata8' = cxE5C1D4                                                 
         'gndata7' = cxCCDFF0                                                 
         'gndata6' = cxDDDEB5                                                 
         'gndata5' = cxDBC7E7                                                 
         'gndata4' = cxD5C6B4                                                 
         'gndata3' = cxB7D4D3                                                 
         'gndata2' = cxE7B3B4                                                 
         'gndata1' = cxBBC2DC                                                 
         'gndata' = cxBBC2DC                                                  
         'gofill' = cxFFFFFF                                                  
         'gout2cend' = cx919191                                               
         'gout2cstart' = cxe9e9e9                                             
         'gblockheader' = cxcfd5de                                            
         'gcphasebox' = cx989EA1                                              
         'gphasebox' = cxDBE6F2                                               
         'gczonec' = cxBECEE0                                                 
         'gzonec' = cxCCDCEE                                                  
         'gczoneb' = cxCCDCEE                                                 
         'gzoneb' = cxD7E5F3                                                  
         'gzonea' = cxE3EDF7                                                  
         'gconramp3cend' = cx9C1C00                                           
         'gconramp3cneutral' = cx222222                                       
         'gconramp3cstart' = cx0E36AC                                         
         'gramp3cend' = cxD05B5B                                              
         'gramp3cneutral' = cxFFFFFF                                          
         'gramp3cstart' = cx667FA2                                            
         'gcontrollim' = cxE6F2FF                                             
         'gccontrollim' = cxBFC7D9                                            
         'gruntest' = cxCAE3FF                                                
         'gcruntest' = cxBF4D4D                                               
         'gclipping' = cxFFFFC6                                               
         'gcclipping' = cxC1C100                                              
         'gaxis' = cx989EA1                                                   
         'greferencelines' = cx989EA1;                                        
      class colors /                                                          
         'link2' = cx0000FF                                                   
         'link1' = cx800080                                                   
         'docbg' = cxFFFFFF                                                   
         'contentbg' = cxFFFFFF                                               
         'systitlebg' = cxFFFFFF                                              
         'titlebg' = cxFFFFFF                                                 
         'proctitlebg' = cxFFFFFF                                             
         'headerbg' = cxEDF2F9                                                
         'captionbg' = cxFFFFFF                                               
         'captionfg' = cx000000                                               
         'bylinebg' = cxFFFFFF                                                
         'notebg' = cxFFFFFF                                                  
         'tablebg' = cxFFFFFF                                                 
         'batchbg' = cxFFFFFF                                                 
         'systitlefg' = cx000000                                              
         'titlefg' = cx000000                                                 
         'proctitlefg' = cx000000                                             
         'bylinefg' = cx000000                                                
         'notefg' = cx000000;                                                 
      class Header /                                                          
         bordercolor = cx000000                                    
         backgroundcolor = cxFFFFFF                                  
         color = cx000000;                                                    
      class Footer /                                                          
         bordercolor = cx000000                                    
         backgroundcolor = cxFFFFFF                                  
         color = cx000000;                                                    
      class RowHeader /                                                       
         bordercolor = cx000000                                    
         backgroundcolor = cxFFFFFF                                  
         color = cx000000;                                                    
      class RowFooter /                                                       
         bordercolor = cx000000                                    
         backgroundcolor = cxFFFFFF                                  
         color = cx000000;                                                    
      class Table /                                                           
         bordertopwidth = 1px                                                 
         borderleftwidth = 1px                                                
         borderbottomwidth = 1px                                              
         borderrightwidth = 1px                                               
         bordercolor = cx000000                                               
         cellpadding = 5;                                                     
      style Data /                                                            
         font = fonts('DocFont')                                              
         backgroundcolor = cxFFFFFF                                           
         bordercolor = cx000000                                               
         bordertopwidth = 1px                                                 
         borderleftwidth = 1px                                                
         borderbottomwidth = 1px                                              
         borderrightwidth = 1px                                               
         borderstyle = solid;                                                 
      class Graph /                                                           
         attrpriority = "Color";                                              
      class GraphFit2 /                                                       
         linestyle = 1;                                                       
      class GraphClipping /                                                   
         markersymbol = "circlefilled";                                       
      class Link /                                                            
         color = colors('link2');                                             
      class VisitedLink /                                                     
         color = colors('link1');                                             
      class ActiveLink /                                                      
         color = colors('link1');                                             
   end;                                                                       
run;

 

 

PhilC
Rhodochrosite | Level 12

After working on these template definitions, for hours, I see ghostly six digit hexadecimal when I blink my eyes.  yuck

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2071 views
  • 0 likes
  • 2 in conversation