- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I've been trying to generate a report with the layout in the image. Each line in the column title references a column in the dataset (e.g. Reported term is the column reported_term, MedDRA Preferred Term is medra_term, and so on). Each cell content should be the concatenation of the texts referred in the title, separated by a new line character. When I generate the HTML and RTF output with PROC REPORT, the result is not the desired (see second image attached, the colored ones should be placed in a new line). My approach involved using CATX with the '0A'x hexadecimal character for newline, and the definition of a split character "#" in PROC REPORT, but none of those give me a good result. If anyone could provide me a little help, I would appreciate it.
Image 1.
Image 2. RTF output from PROC Report
/* Building final dataset for before reporting */
DATA ae_test_final;
SET ae_test_2;
/* First column */
length subj_seqno $50;
length reportmdra $150;
length startendt $50;
/* Subject \n Seqno */
subj_seqno = catx('0A'x, strip(subject_id), strip(put(ae_count, 3.)));
/* Reported Term \n MedDRA Preferred Term \n MedDRA System Organ Class*/
reportmdra = catx('0A'x,
strip(reported_term),
strip(meddra_prefer),
strip(meddra_sorgan));
/* Start Date+time/number days \n End Date+time/number days */
if missing(enddate_2) then
startendt = put(startdate_2, YYMMDD10.) || " " || starthour_ae || " / " ||
strip(put(ndays_start, 6.)) || "#" ||
"Ongoing / -";
else
startendt = put(startdate_2, YYMMDD10.) || " " || starthour_ae ||
" / " || strip(put(ndays_start, 6.)) || "#" ||
put(enddate_2, YYMMDD10.) || " " || endhour_ae || " / " ||
strip(put(ndays_end, 6.));
RUN;
options orientation=landscape;
ods rtf file="/~/listing.rtf";
ods escapechar="^";
PROC REPORT data=ae_test_final
nowd headline headskip split="#" missing;
column subj_seqno reportmdra startendt;
define subj_seqno / "Subject # Seqno" order;
define reportmdra / "Reported Term # MedDRA Preferred Term #
MedDRA System Organ Class" left flow;
define startendt / "Start Date + time / number days #
End Date + time / number days" left flow;
RUN;
ods rtf close;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
See if this approach to inserting a Newline call works for you. You should have the Sashelp.Class data set to test the code with.
data work.class; set sashelp.class; length n_s $ 35; n_s = catx('^{newline}',name, sex); run; ods escapechar='^'; proc report data=work.class split='#'; columns n_s; define n_s/ display "Name # Sex"; run;
One theng to note is the Escapechar functions do want the curly braces.
Also I suggest setting a specific variable length for your variables made with the various concatenations you are using. Some of these will default to very long lengths and may cause odd behaviors as a result.
You will find out that some of the "white space" characters such as leading spaces, tabs and possibly the carriage return or line feed characters will be treated differently, such as ignored, in the body of procedure output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
See if this approach to inserting a Newline call works for you. You should have the Sashelp.Class data set to test the code with.
data work.class; set sashelp.class; length n_s $ 35; n_s = catx('^{newline}',name, sex); run; ods escapechar='^'; proc report data=work.class split='#'; columns n_s; define n_s/ display "Name # Sex"; run;
One theng to note is the Escapechar functions do want the curly braces.
Also I suggest setting a specific variable length for your variables made with the various concatenations you are using. Some of these will default to very long lengths and may cause odd behaviors as a result.
You will find out that some of the "white space" characters such as leading spaces, tabs and possibly the carriage return or line feed characters will be treated differently, such as ignored, in the body of procedure output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content