BookmarkSubscribeRSS Feed
nirali514
Obsidian | Level 7

Hi! I was hoping someone could help me out with figuring out how to add a border only to the last row where panel = 1, panel =2 and panel =3.

The data loks something like this

 

panel   job  case

1      doctor    x

1      nurse     x

1      doctor    y

2      doctor    z

2      stats      x

2      stats      z

 

 

 

This is what my code looks like now, however, there is a line that shows after every row where panel=1

 

ods listing close;

ods escapechar = '^';

ods noproctitle;

options nodate number;

footnote;

ODS RTF FILE = 'C:\Desktop\out.rtf'

author = 'NN'

title = XX

bodytitle

startpage = no

style =sasdocprinter;

options papersize = legal

papersize = legal

leftmargin = 1in

rightmargin = 1in

orientation = portrait; /*landscape*/

title1 font = 'Times New Roman' height = 11pt justify = center underlin = 0 color = black bcolor = white 'Table 3: Outiers using Non-Transformed Data';

footnote1 font = 'Times New Roman' height = 11pt justify = center underlin = 0 color = black bcolor = white 'XXX.';

 

proc report data = perm.outliers nowindows headline headskip missing center

style(report)=[cellspacing=2 borderwidth=2 bordercolor=black]

style(header) = {font_weight = light font_face = 'Times New Roman' font_size = 11pt just = center cellheight=.4in }

style(column) = {font_face = 'Times New Roman' font_size = 11pt just = center /*asis = on*/ cellheight=.22in};

column panel job case ;

define panel / display /*order group*/ ' /Panel' center style=[cellwidth=15mm] ;

define job / display ' /Job' center style=[cellwidth=20mm];

define case / display ' /Case' center style=[cellwidth=15mm];

 

 

compute panel ;

if panel=1;

call define(_row_,'style', 'style=[foreground=black background=white borderbottomcolor=black borderbottomwidth=3]');

endcomp;

 

 

 

endcomp;

run;

ods rtf close;

8 REPLIES 8
Cynthia_sas
SAS Super FREQ
Hi:
I am not sure you can set the borders conditionally or whether the destination makes a difference. This would be a better question to ask of Tech Support.

cynthia
nirali514
Obsidian | Level 7

Thank you Cynthia!

Martha
Fluorite | Level 6

I realize that this question was originally posted some time ago, but did you ever get an answer? I am having this exact problem. I am outputting to RTF and I think the proc report border options are limited for that destination.

nirali514
Obsidian | Level 7
I did! What’s your problem exactly? And what would you like to see?
Martha
Fluorite | Level 6

I think it's nearly identical to the originally posted issue. I have grouped data and I want to add a solid border separating the groups. 

 

This is what my code is doing (please ignore the lack of a legend and other problems, this is just for an example):

Output 1.png

Here is what I want it to do (with the line separating hand and foot):

Desired Output.png

 

Sample code is as follows:

proc format ;
	value $ outfmt  /* Format outcomes */
		"0" = "c"
		"1" = "g";
run;

data example;
	input Patient Order Location $ Day Symptom ;
datalines;
1 1 Hand 1 0
1 1 Hand 2 0
1 1 Hand 3 1
2 1 Hand 1 1
2 1 Hand 3 1
3 1 Foot 1 0
3 1 Foot 2 0
3 1 Foot 3 0
4 1 Foot 1 1
4 1 Foot 2 0
;
run;


/* Table attempt */
 ods rtf file="&outpath.\demo.rtf"  style=minimal ;
 OPTIONS ORIENTATION=PORTRAIT MISSING = "";

 	proc report nowindows data=example split="`" 
		style=[frame=hsides rules=groups ] 
		style(header lines column)=[font_face="times new roman" font_size=11 pt]; 
 		column Order Patient ("Location" Location) Day, Symptom; 
 		define Order / group noprint order=data ;
		 define Patient / group noprint  ;

		 define Location /  group " " ;
		 define Day / across "Day" 	 order = internal  ; 
		 define Symptom / 	format= $outfmt. group " " STYLE(COLUMN) = {JUST = C CellWidth=6% font_face="webdings"};

		 /*This is what I'm trying that doesn't work */
		 compute after Order / style={BORDERBOTTOMCOLOR = black}	;
		 endcomp;

 run;

 ods rtf close; 
Cynthia_sas
SAS Super FREQ

Hi:
I'm not sure that you'll get a break where you want it because ORDER is 1 for every row in your data. I would have expected you to have ORDER=1 for all the HAND rows and ORDER=2 for all the FOOT rows. OR something like that. Right now, with just ORDER=1, the only break will be at the bottom and you already have a line there from HSIDES.

I also think you'll at least need:
line ' ';
inside the compute block for any action to take place. The compute block will only use the style for any written inside the compute block.

 

Cynthia

Martha
Fluorite | Level 6

Thanks for the response. You are right about the order variable. It's actually correct in my real data, but I made a mistake with that example data. The example data should be:

 

data example;
	input Patient Order Location $ Day Symptom ;
datalines;
1 1 Hand 1 0
1 1 Hand 2 0
1 1 Hand 3 1
2 1 Hand 1 1
2 1 Hand 3 1
3 2 Foot 1 0
3 2 Foot 2 0
3 2 Foot 3 0
4 2 Foot 1 1
4 2 Foot 2 0
;
run;

I am able to add a line break as suggested. That produces a line break and the desired border in the HTML output in the results viewer, but only the line break (not the border) in the RTF output.

Cynthia_sas
SAS Super FREQ

Hi:

This works for me in RTF -- running SAS 9.4 M5:

border_divide.png

 

Perhaps you just need a blank LINE statement.

 

In my code, since you quoted the values for Symptom in the format, I made the INPUT statement character and the format character in the DEFINE Statement. I changed the style to JOURNAL instead of MINIMAL and did a explicit border width of 3px.

 

Anyway, hope this helps,

Cynthia

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 8 replies
  • 3191 views
  • 1 like
  • 3 in conversation