I am going to add a double line at certain group, but not all group, how can I do that?
here is the dataset
data lines;
input section column1$ column2$ column3$ column4$ column5$;
return;
cards;
1 A B C D E
1 A B C D E
1 A B C D E
1 B C D E F
1 B C D E F
1 C D E F G
2 C D E F G
;
run;
program was used:
ods listing close;
ods rtf file = "D:\from desk\example_lines.rtf" style=journal;
proc report data=lines NOWINDOWS
STYLE(report)=[frame=box rules=cols]
style(header)={borderbottomwidth=2pt borderbottomcolor=black};
title '3) Using border lines as a divider';
column section column1 column2 column3 column4 column5;
define section / order order=data noprint;
define column1 / "Column 1";
define column2 / "Column 2";
define column3 / "Column 3";
define column4 / "Column 4";
define column5 / "Column 5";
compute after section /
style={height=1px bordertopcolor=black borderbottomcolor=black cellpadding=0
bordertopstyle=solid borderbottomstyle=solid
bordertopwidth=2pt borderbottomwidth=2pt};
line ' ';
endcomp;
run;
ods _all_ close;
Table is attached, which was created by the program above.
if just want to create double line at the end of section 1 (supress the double line at section 2), do not need the double line at the end, how can I reach that? Thank you!
Hi:
Another way to do it without using CALL DEFINE is to test the value of the grouping variable. The borders around the LINE output will only appear when you are displaying the LINE. With a length of 0, the border between CANADA and PACIFIC do not show because the LINE is suppressed.
cynthia
Thank you! Cynthia_sa
data lines; input section column1$ column2$ column3$ column4$ column5$; return; cards; 1 A B C D E 1 A B C D E 1 A B C D E 1 B C D E F 1 B C D E F 1 C D E F G 2 C D E F G ; run; ods rtf file = "/folders/myfolders/example_lines.rtf" style=journal; proc report data=lines NOWINDOWS STYLE(report)={frame=box rules=cols} style(header)={borderbottomwidth=2pt borderbottomcolor=black}; title '3) Using border lines as a divider'; column section column1 column2 column3 column4 column5 section; define section / order order=data noprint; define column1 / "Column 1"; define column2 / "Column 2"; define column3 / "Column 3"; define column4 / "Column 4"; define column5 / "Column 5"; compute after section ; if section=1 then call define(_row_,'style', 'style={height=1px cellpadding=0 bordertopwidth=2pt borderbottomwidth=2pt bordertopstyle=solid borderbottomstyle=solid bordertopcolor=black borderbottomcolor=black }' ); line ' '; endcomp; break after section/summarize; run; ods rtf close;
Thank you! Ksharp,
It works, but not perfect, there is too much space at the last row.
OK. I misunderstood what you mean. data lines; input section column1$ column2$ column3$ column4$ column5$; return; cards; 1 A B C D E 1 A B C D E 1 A B C D E 1 B C D E F 1 B C D E F 1 C D E F G 2 C D E F G ; run; ods rtf file = "/folders/myfolders/example_lines.rtf" style=journal; ods escapechar='~'; proc report data=lines NOWINDOWS STYLE(report)={frame=box rules=cols} style(header)={borderbottomwidth=2pt borderbottomcolor=black}; title '3) Using border lines as a divider'; column section column1 column2 column3 column4 column5 section; define section / order order=data noprint; define column1 / "Column 1"; define column2 / "Column 2"; define column3 / "Column 3"; define column4 / "Column 4"; define column5 / "Column 5"; compute after section ; line= "~S={height=1px cellpadding=0 bordertopwidth=2pt borderbottomwidth=2pt bordertopstyle=solid borderbottomstyle=solid bordertopcolor=black borderbottomcolor=black } " ; len=0; if section=1 then len=200; line line $varying200. len; endcomp; run; ods rtf close;
Hi. Ksharp,
Thank you very much! This one is close to waht I want, but the line doesn't show up, I use SAS 9.3, probably SAS version problem? Thanks again.
data lines; input section column1$ column2$ column3$ column4$ column5$; return; cards; 1 A B C D E 1 A B C D E 1 A B C D E 1 B C D E F 1 B C D E F 1 C D E F G 2 C D E F G ; run; ods rtf file = "/folders/myfolders/example_lines.rtf" style=journal; ods escapechar='~'; proc report data=lines NOWINDOWS STYLE(report)={frame=box rules=cols} style(header)={borderbottomwidth=2pt borderbottomcolor=black}; title '3) Using border lines as a divider'; column section column1 column2 column3 column4 column5 section; define section / order order=data noprint; define column1 / "Column 1"; define column2 / "Column 2"; define column3 / "Column 3"; define column4 / "Column 4"; define column5 / "Column 5"; compute after section ; line= "~S={height=1px cellpadding=0 bordertopwidth=2pt borderbottomwidth=2pt bordertopstyle=solid borderbottomstyle=solid bordertopcolor=black borderbottomcolor=black } " ; len=0; if section=1 then len=200; line line $varying200. len; endcomp; run; ods rtf close;
Hi:
Another way to do it without using CALL DEFINE is to test the value of the grouping variable. The borders around the LINE output will only appear when you are displaying the LINE. With a length of 0, the border between CANADA and PACIFIC do not show because the LINE is suppressed.
cynthia
Thank you so much! Cynthia_sas,
This one works great!
Nice to meet you, My name Ozawa from Japan.
May I have additional question.
Can I have lilke a attachement table ( below image table ) ?
Ozawa
How about this one ? data lines; input section column1$ column2$ column3$ column4$ column5$; return; cards; 1 A B C D E 1 A B C D E 1 A B C D E 1 B C D E F 1 B C D E F 1 C D E F G 2 C D E F G ; run; data _null_; set lines; by section; if last.section and section=1 then call symputx('n',_n_); run; %put &n ; ods rtf file = "/folders/myfolders/example_lines.rtf" style=journal; proc report data=lines NOWINDOWS out=x STYLE(report)={frame=box rules=cols cellspacing=0 } style(header)={borderbottomwidth=2pt borderbottomcolor=black}; title '3) Using border lines as a divider'; column section column1 column2 column3 column4 column5; define section / order order=data noprint; define column1 / "Column 1"; define column2 / "Column 2"; define column3 / "Column 3"; define column4 / "Column 4"; define column5 / "Column 5"; compute column5; count+1; if count=&n then call define(_row_,'style','style={borderbottomstyle=double}'); endcomp; run; ods rtf close;
Thank you Ksharp.
1st: I submitted your code in SAS 9.2 (our company's environment) .
=> Did not appear the double line.
I show your attachment 'x.png' , I think SAS version issue.
Next, I submitted your code in SAS OnDemand for Academics (SAS Studio).
=> Displayed the double line. Good for me.
Thank you
Ozawa
cynthia.
There is no problem.
Our company will soon update the SAS9.4.
Thank you
Ozawa
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.