BookmarkSubscribeRSS Feed
JMKang
Calcite | Level 5

Hi, I'm trying to add horizontal lines in my ODS excel output.

This is my sas code.

 

ods excel file='C:\Users\Administrator\Desktop\ODS\reportex.xlsx' style=SasDocPrinter
options(embedded_titles='yes' frozen_headers='yes' start_at='2,2' absolute_column_width='8' );
title1 font='Calibri' color=crimson bold h=30pt 'I Love Blue Color';
proc report data=vintexample
style(header)=[font_style=italic background=lightred fontsize=4 font_face='Calibri' foreground=white]
style(column)=[font_face='Calibri'];
define year / display group style(header)=[background=#000000];
define month / display style(header)=[background=#00096F];
define cnt / display style(header)=[background=#002D93];
define loan / display style(header)=[background=#1F51B7];
define m2 / display style(header)=[background=#4375DB];
define m3 / display style(header)=[background=#6799FF];
define m4 / display style(header)=[background=#8BBDFF];
define m5 / display style(header)=[background=#9DCFFF];
define m6 / display style(header)=[background=#C1F3FF];
compute year ;
if year gt ' ' then
call define(_row_,'style',
'style={bordertopcolor=black bordertopwidth=1}');
endcomp;
run;
ods excel close;

 

 

캡처1.JPG

In the SAS report output, It appears horizontal lines that separating years.

 

But when I execute Excel, I cannot found any lines...

캡처2.JPG

 

How can I add horizontal lines in my ODS excel output? 

1 REPLY 1
Ksharp
Super User

Try 

compute year ;
if year gt ' ' then
call define(_row_,'style',
'style={bordertopcolor=darkblack bordertopwidth=1}');
endcomp;

 

or try another style:

style={bordertoptype=

 

or use LINE statement:

computer after year/ style(line)={background=black};

line ' ';

endcomp;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 1720 views
  • 0 likes
  • 2 in conversation