Hi,
I am using a proc report to generate a summary. I would like to insert a blank line above and below for only one variable and rest of them wihout any blank lines.
I am not able use the headline for ODS RTF output.
The format is some what like the below:
Header
----------
Space
Overall value
space
var1
var2
var3
------------
Thank you in advance.
Hi: HEADLINE and HEADSKIP options are LISTING only options and will never work with RTF destinations or any destination that supports style. Those options were originally designed for the SAS output windows or "LST" output and were never carried forward into the world of ODS style.
Also, your code has STYLE=x.styles, which you do not provide.
It does not matter. There really isn't the concept of "lines" really, but you can insert spaces and if you use the textdecoration=underline or overline, you can mimic lines, but they will be in a proportional spaced font.
AND, when I try your code, even without the style, I get an error:
ERROR: Variable numobs is not on file WORK.CLASS3.
Does your code, as posted, work without errors?
I'm not sure of your purpose for the PROC MEANS followed by the transpose. Many of the statistics you can get out of MEANS you can also request directly from PROC REPORt and/or PROC TABULATE.
For example, consider this code that uses SASHELP.CLASS directly without MEANS/TRANSPOSE and uses the JOURNAL style (since you did not provide your style):
proc format;
value $genfmt 'F' = 'Female'
'M' = 'Male'
'T' = 'Total';
run;
ods rtf file='c:\temp\direct_report_stat.rtf' style=journal;
proc report data=sashelp.class;
column sex n height,(sum mean max) weight,(sum mean max);
define sex / group f=$genfmt.;
define n / 'NumObs';
define height / analysis;
define weight / analysis;
define sum / 'Sum' f=comma6.1;
define mean / 'Mean' f=6.1;
define max / 'Max' f=6.1;
rbreak after / summarize;
compute sex;
if _break_ = '_RBREAK_' then do;
sex = 'T';
end;
endcomp;
run;
ods rtf close;
And, output is (shown in RTF and HTML):
cynthia
As a minimum you show code of what you have so far. Things interact in proc report and knowing things like the order of columns and such may help provide a solution. Better would be to include a data, in the form of a data step, so we can test against some of your data.
You can turn a SAS data set into data step code:Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
Hi: HEADLINE and HEADSKIP options are LISTING only options and will never work with RTF destinations or any destination that supports style. Those options were originally designed for the SAS output windows or "LST" output and were never carried forward into the world of ODS style.
Also, your code has STYLE=x.styles, which you do not provide.
It does not matter. There really isn't the concept of "lines" really, but you can insert spaces and if you use the textdecoration=underline or overline, you can mimic lines, but they will be in a proportional spaced font.
AND, when I try your code, even without the style, I get an error:
ERROR: Variable numobs is not on file WORK.CLASS3.
Does your code, as posted, work without errors?
I'm not sure of your purpose for the PROC MEANS followed by the transpose. Many of the statistics you can get out of MEANS you can also request directly from PROC REPORt and/or PROC TABULATE.
For example, consider this code that uses SASHELP.CLASS directly without MEANS/TRANSPOSE and uses the JOURNAL style (since you did not provide your style):
proc format;
value $genfmt 'F' = 'Female'
'M' = 'Male'
'T' = 'Total';
run;
ods rtf file='c:\temp\direct_report_stat.rtf' style=journal;
proc report data=sashelp.class;
column sex n height,(sum mean max) weight,(sum mean max);
define sex / group f=$genfmt.;
define n / 'NumObs';
define height / analysis;
define weight / analysis;
define sum / 'Sum' f=comma6.1;
define mean / 'Mean' f=6.1;
define max / 'Max' f=6.1;
rbreak after / summarize;
compute sex;
if _break_ = '_RBREAK_' then do;
sex = 'T';
end;
endcomp;
run;
ods rtf close;
And, output is (shown in RTF and HTML):
cynthia
Make a dummy group variable.
data class;
set sashelp.class;
retain g 1;
run;
proc report data=class nowd;
column g sex weight;
define g/group noprint;
define sex/group;
define weight/sum;
compute before g;
line ' ';
endcomp;
compute before;
line ' ';
endcomp;
break before g/summarize;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.