BookmarkSubscribeRSS Feed
diwashsapkota
Calcite | Level 5

I want to display the categories (At Least One Event, Hypertension, Palpitation...) inside the row headers (Cardiac Disorders, Infections and Infestations...) in my ods rtf output as it looks in the following image:
a.jpg

 

But my code is giving me output in the following format:
b.png

 

Any idea would be heartily appreciated.

7 REPLIES 7
ballardw
Super User

Please include the code you are currently using including any ODS destination, RTF PDF or other, options. That way we at least have some chance of knowing where changes might be applicable.

 

Possible likely changes might include adding some leading spaces to the values that need to Indent and using the Style option ASIS=On

A_Kh
Lapis Lazuli | Level 10

Did you try to add a LINE statement in COMPUTE block? 

Your data has multiple groups, and in your screenshot each group is separated by an empty line (row). If this is what you want, add an extra LINE statement in your compute block. 

See the example below; 

data have;
length groups 4 disease total $15; 
input groups disease total;
cards;
1 hypertension 100
1 palpitation 200
2 infection 110
2 infestation 210
;

proc report data=have;
	column groups disease total;
	define groups/order noprint;
	define disease/ display;
	define total/ display;
	compute before groups;
		line '';
		line @1 text $100.;
		length text $100;
		if groups=1 then text= 'Cardiac disorders';
		else if groups=2 then text='Infections and Infestations';
	endcomp; 
run; 

 

diwashsapkota
Calcite | Level 5

Sure, here is my code for the report:

options papersize='LETTER' orientation=landscape topmargin='2.54cm' 
	bottommargin='2.54cm' leftmargin='2.54cm' rightmargin='2.54cm' nodate nonumber 
	missing=' ';
%** Create template for TLFs **;

proc template;
	%** Courier 9pt **;
	define style styles.ods_9pt;
		parent=styles.rtf;
		replace fonts/ 'TitleFont2'=("Courier New", 9pt) 'TitleFont'=("Courier New", 
			9pt) 'FootnoteFont'=("Courier New", 9pt) 'StrongFont'=("Courier New", 9pt) 
			'EmphasisFont'=("Courier New", 9pt) 'FixedEmphasisFont'=("Courier New", 9pt) 
			'FixedStrongFont'=("Courier New", 9pt) 'FixedHeadingFont'=("Courier New", 
			9pt) 'BatchFixedFont'=("Courier New", 9pt) 'FixedFont'=("Courier New", 9pt) 
			'headingEmphasisFont'=("Courier New", 9pt) 'headingFont'=("Courier New", 
			9pt) 'docFont'=("Courier New", 9pt);
		replace document from container / asis=on protectspecialchars=off;
		replace SystemFooter from TitlesAndFooters / asis=on protectspecialchars=on 
			font=Fonts('FootnoteFont');
		replace systemtitle from titlesandfooters/ asis=on protectspecialchars=off;
		replace body from document / asis=on;
		replace color_list "Colors used in the default style" / 'link'=blue 
			'bgH'=white 'fg'=black 'bg'=white;
		replace Table from output / Background=_UNDEF_ cellpadding=0pt Rules=groups 
			Frame=hsides;
		style Header from Header / Background=_undef_;
		style Rowheader from Rowheader / Background=_undef_;
		replace pageno from titlesandfooters/ Foreground=white;
	end;
run;

ods rtf file='/home/u63366981/01_adam/results/tableae.rtf' style=styles.ods_9pt;
ods rtf startpage=now;
ods escapechar='#';

%let current_date = %sysfunc(date(), yymmdd10.);
%let current_time = %sysfunc(time(), time5.);

title1 color="black" justify=left "Protocol:CDISCPILOT01" justify=right 'Page #{thispage} of #{lastpage}';
title2 color="black" justify=left "Population:Safety" justify=right "Date: &current_date. &current_time.";
title3 color="black" justify=center bold "Template 13";
title4 color="black" justify=center 
	"Incident of Treatment Emergent Adverse Events by Treatment Group";
options center number;

proc report data=final2 nowindows nowd headline headskip split='*' 
		out=finalreport;
	column (aeterm ("Placebo (N=&bign1.)" trt1 tot1) 
		("Xanomeline High*Dose (N=&bign2.)" trt2 tot2) 
		("Xanomeline Low*Dose (N=&bign3.)" trt3 tot3) (z1) (z2));
	define aeterm/'System Organ Class * PREFERRED TERM' left;
	define trt1/'n (%)' style(column)=[cellwidth=1in] left;
	define tot1/'Total*Events' center;
	define trt2/'n (%)' style(column)=[cellwidth=1in] left;
	define tot2/'Total*Events' center;
	define trt3/'n (%)' style(column)=[cellwidth=1in] left;
	define tot3/'Total*Events' center;
	define z1/'Placebo vs. Xan. Low Dose p-value' style(column)=[cellwidth=0.5in]
		center;
	define z2/'Placebo vs. Xan. High Dose p-value' style(column)=[cellwidth=0.5in] center;

	footnote1 justify=left "Treatment emergent events are defined as events which start or worsen or recur on or after the start of treatment.";
	footnote2 justify=left "Adverse events are coded using MedDRA.";
	footnote3 justify=left "Percentages are based on the number of subjects in the safety population within each treatment group.";
	footnote4 justify=left "P-values are based on Fisher's Exact test for the comparison of placebo versus each active treatment group.";
	footnote5 justify=left "Total Events represent the total number of times an event was recorded within each treatment group.";
run;

ods rtf close;
diwashsapkota
Calcite | Level 5
Sorry, I could not understand it clearly. Is there any resource you'd recommend me to go through on creating tables from the data?
Cynthia_sas
SAS Super FREQ

Hi:

  Please search in the forums for examples of using INDENT= and LEFTMARGIN= as style overrides. There have been more than a few postings, with example code of how to perform indentation on a demographic report like this. Here are a few of them:

https://communities.sas.com/t5/ODS-and-Base-Reporting/Indent-different-rows-of-a-column-in-RTF/m-p/2...

https://communities.sas.com/t5/ODS-and-Base-Reporting/Compute-block-indent-left-margin-only-working-...

https://communities.sas.com/t5/ODS-and-Base-Reporting/Shift-within-one-column-in-Proc-Report/m-p/405...

  In addition, I recommend that you look at your TEMPLATE code. The REPLACE statement was deprecated starting in SAS 9.2, so you may or may not be getting the results you expect with the current template code.

  In addition, options like HEADLINE and HEADSKIP are LISTING only options and not used in ODS RTF. Also, keep in mind that when you do accomplish the indenting you want, it will NOT be saved into your OUT= data file. There are not any styles applied to SAS data sets, only to the ODS RTF result file.

Cynthia

A_Kh
Lapis Lazuli | Level 10

A quick google search gave me this paper.  Check the use of COMPUTE blocks there. 

tarheel13
Rhodochrosite | Level 12

you can follow what's in this paper. they have examples of AE tables. https://support.sas.com/resources/papers/proceedings20/4936-2020.pdf 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 7 replies
  • 1085 views
  • 0 likes
  • 5 in conversation