The SAS Output Delivery System and reporting techniques

Proc Report results not matching expected output

Super Contributor
Posts: 272

Proc Report results not matching expected output

[ Edited ]

For my question you asked for the report produced with the code;


I need to produce a report like this: File attached

my report file that was created by my code


Iused code: The output doesnot look same. Please help


OPTIONS nodate nonumber;
ods listing close;
ods escapechar="^";
title1 justify=right 'page ^{pageof}';
title2 "Table Treatment-Emergent Adverse Event Frequency by Treatment -";

title3 "Number of Subjects Reporting the Event (% of Subjects Dosed) (Safety Population)";
footnote1 "Note: Adverse events (AEs) were coded with MedDRA Version 18.0.";
footnote2 "Program: /CA17139/sas_prg/stsas/tab/ 16DEC2015 12:16";
footnote2 " %sysget(sas_execfilepath) &sysdate. &systime.";
options orientation=landscape formchar="|----|+|---+=|-/\<>*";

ods rtf file="C:\Users\vvemireddy\Desktop\ae_1.rtf" style=journal;
proc report data=four nowd headline headskip style(report)=[frame=void];
column grp aebodsys aedecod aetext cnt_pct4 ("JPZ" "_______________" cnt_pct1 cnt_pct2) cnt_pct3 cnt_pct5;
define grp/order noprint;
define aebodsys/order noprint;
define aedecod/display center noprint;
define aetext/ display 'Adverse Event' style(column)={asis=on cellspacing=.25pt just=left};
define cnt_pct1 / "300 mg" style(column)={cellspacing=.25pt just=left};
define cnt_pct2/ "900 mg" style(column)={cellspacing=.25pt just=left} ;
define cnt_pct3/ "400 mg Moxifloxacin" style(column)={cellspacing=.25pt just=left};
define cnt_pct4/"Plcebo" style(column)={cellspacing=.25pt just=left} ;
define cnt_pct5/"TOTAL" style(column)={cellspacing=.25pt just=left} ;
compute after grp/style={protectspecialchars=off};
line dummy $varying20. len;
ods rtf close;


Super Contributor
Posts: 272

Re: Proc Report results not matching expected output

I need to have my output like the file attached. I attached the the code and output in my previous post. Thank you

Super User
Posts: 19,170

Re: Proc Report results not matching expected output

Without sample data we can't say what in your code isn't working.

Super User
Posts: 11,134

Re: Proc Report results not matching expected output

[ Edited ]

Please be explicit in stating what the issue with your current output compared with your desired.

I am guessing that you are not getting something to line up as desired but is purely a guess.


And since you do not show any statistics or compute statements then I am again guessing that the values for your cnt_pct1 etc. variables are character. In which case the internal space use between the () is going to be incorrect because they are not built correctly .

Also since you are using JUST=LEFT everywhere then values like 7 ( 12%) or 0 (  0%) will not align with values above like 47 ( 81%) because you told them to shift to the left removing the leading spaces.


Additionally ODS RTF and style=Journal (almost ALL styles actually) will use proportional fonts. That means that each character takes up different amounts of space and blanks do not take up anywhere near as much space as most charcters. So alignment by guessing how many spaces to insert will be a nightmare, if at all possible. If you create a modified style that defaults to using a monospace font,

such as Courier New, that might be possible.


Since that example desired output looks a LOT like old line-printer output, you could also try directing the output to LISTING and saving the file as Plain text. Print with a monospace font or open in wordprocessor program and set to a monospace font.



Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation