Hi All,
Greetings for the day!
In the below dummy data i am try to produce a lab shift RTF output using preloadfmt option in proc report. But dont know why its causing lots of blank rows.
The dummy data:
TRT01AN | AVISITN | AVISIT | BAVALN | BCNT | AVALN | PCT |
1 | 1 | Day 1 | 1 | 40 | 1 | 29 (72.5) |
1 | 1 | Day 1 | 1 | 40 | 2 | 11 (27.5) |
1 | 1 | Day 1 | 2 | 15 | 1 | 4 (26.7) |
1 | 1 | Day 1 | 2 | 15 | 2 | 11 (73.3) |
1 | 2 | Day 2 | 1 | 37 | 1 | 30 (81.1) |
1 | 2 | Day 2 | 1 | 37 | 2 | 7 (18.9) |
1 | 2 | Day 2 | 2 | 14 | 1 | 2 (14.3) |
1 | 2 | Day 2 | 2 | 14 | 2 | 12 (85.7) |
1 | 3 | Day 3 | 1 | 35 | 1 | 25 (71.4) |
1 | 3 | Day 3 | 1 | 35 | 2 | 10 (28.6) |
1 | 3 | Day 3 | 2 | 13 | 1 | 4 (30.8) |
1 | 3 | Day 3 | 2 | 13 | 2 | 9 (69.2) |
2 | 1 | Day 1 | 1 | 39 | 1 | 35 (89.7) |
2 | 1 | Day 1 | 1 | 39 | 2 | 4 (10.3) |
2 | 1 | Day 1 | 2 | 23 | 1 | 8 (34.8) |
2 | 1 | Day 1 | 2 | 23 | 2 | 15 (65.2) |
2 | 2 | Day 2 | 1 | 36 | 1 | 32 (88.9) |
2 | 2 | Day 2 | 1 | 36 | 2 | 4 (11.1) |
2 | 2 | Day 2 | 2 | 23 | 1 | 7 (30.4) |
2 | 2 | Day 2 | 2 | 23 | 2 | 16 (69.6) |
2 | 3 | Day 3 | 1 | 34 | 1 | 31 (91.2) |
2 | 3 | Day 3 | 1 | 34 | 2 | 3 (8.8) |
2 | 3 | Day 3 | 2 | 23 | 1 | 7 (30.4) |
2 | 3 | Day 3 | 2 | 23 | 2 | 16 (69.6) |
3 | 1 | Day 1 | 1 | 31 | 1 | 25 (80.6) |
3 | 1 | Day 1 | 1 | 31 | 2 | 6 (19.4) |
3 | 1 | Day 1 | 2 | 28 | 1 | 11 (39.3) |
3 | 1 | Day 1 | 2 | 28 | 2 | 17 (60.7) |
3 | 2 | Day 2 | 1 | 29 | 1 | 24 (82.8) |
3 | 2 | Day 2 | 1 | 29 | 2 | 5 (17.2) |
3 | 2 | Day 2 | 2 | 27 | 1 | 8 (29.6) |
3 | 2 | Day 2 | 2 | 27 | 2 | 19 (70.4) |
3 | 3 | Day 3 | 1 | 28 | 1 | 21 (75.0) |
3 | 3 | Day 3 | 1 | 28 | 2 | 7 (25.0) |
3 | 3 | Day 3 | 2 | 25 | 1 | 9 (36.0) |
3 | 3 | Day 3 | 2 | 25 | 2 | 15 (60.0) |
3 | 3 | Day 3 | 2 | 25 | 3 | 1 (4.0) |
The code is used:
proc import
datafile="<path>/dummy.xlsx"
out=dummy
dbms=xlsx
replace;
sheet="dummy";
getnames=Yes;
run;
proc format;
value egres_ (notsorted)
1="NORMAL"
2="ABNORMAL, NCS"
3="ABNORMAL, CS"
4="Missing/Not collected"
;
value trt (notsorted)
1="Drug A"
2="Drug B"
3="Placebo"
;
value vis (notsorted)
1="Day 1"
2="Day 2"
3="Day 3"
;
run;
proc sort data=dummy; by trt01an; run;
ods rtf file="<path>/dummy.rtf";
option orientation=landscape;
proc report
data=dummy spacing=1 headskip headline completerows missing spanrows
style(report)=[ rules=groups
frame=void
just=center
protectspecialchars=off
cellpadding=1
cellspacing=1
font_face=consolas
width=75%]
style(header)=[ protectspecialchars=off
cellpadding=1
cellspacing=1
background=white
font_face=consolas]
style(column)=[ protectspecialchars=off
cellpadding=1
cellspacing=1
background=white
font_face=consolas]
;
column ('\brdrt\brdrs\brdrw' trt01an avisitn ( bavaln bcnt ) ( avaln, pct));
define trt01an / group noprint format=trt. preloadfmt;
define avisitn / 'Visits' group order=data style=[just=left] format=vis. preloadfmt;
define bavaln / 'Baseline' group format=egres_. style=[just=left] order=data preloadfmt;
define bcnt / 'N' id display style=[just=left];
define avaln / "Worst post baseline"'\brdrb\brdrs\brdrw' across format=egres_. order=data preloadfmt;
define pct / "" spacing=1;
break after avisitn / skip;
break after trt01an / page;
compute before _page_ / style=[just=Left font_face=consolas] ;
line @1 "Treatment :" trt01an trt.;
endcomp;
title1 j=c "Interpetation shift from Baseline to Worst Postbaseline";
run;
ods rtf close;
The report am getting:
Please let me how can i get rid of these missing rows while using the preloadfmt option.
Please provide example data in the form of working data step code.
It might help to show us the LOG from your run. Copy the text from the log for the Proc report with all of the notes and messages, open a text box on the forum and paste the text.
What does the output look like without inserting raw RTF codes like this: (the \brdrt\brdrs stuff if you aren't familiar)
column ('\brdrt\brdrs\brdrw' trt01an avisitn ( bavaln bcnt ) ( avaln, pct));
You may want to examine this thread: https://communities.sas.com/t5/SAS-Programming/Proc-Report-quot-quot-R-RTF-brdrb-brdrs-quot-Issues/t...
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.