FOCUS AREAS

Return to previous page

Base SAS

Example Code for Simulating LISTING Options in ODS


The below code writes a blank line for the last break line. This is a replacement for the SKIP option.

ods html file='temp.html';

proc report data=sashelp.class nowd;
column age height;
define age /group;
compute after age;
   line ' ';
endcomp;
run;

ods html close;

The below adds a double underline for summary values. This is a replacement for the DUL option.

ods html file='temp.html';

proc report data=sashelp.class nowd wrap
style(column)={background=_undef_}
style(report)={rules=none frame=void background=_undef_}
style(header)={background=_undef_}
style(summary)={htmlstyle="border-bottom:2px thick double green"};
define age / order;

break after age / summarize ;

run;

ods html close;

The Border-Top property can be used as a replacement for the DOL option.

ods html file='temp.html';

proc report data=sashelp.class nowd
style(column)={background=_undef_}
style(report)={rules=none frame=void background=_undef_}
style(header)={background=_undef_}
style(summary)={htmlstyle="border-top:thick double green"};
define age / order;

break after age / summarize ;

run;

ods html close;

The UL option's single underline can be simulated by using the Border-Top property. You can also specify the size of the line by specifying an argument with the unit.

ods html file='temp.html';

proc report data=sashelp.class nowd
style(column)={background=_undef_}
style(report)={rules=none frame=void background=_undef_}
style(header)={background=_undef_}
style(summary)={htmlstyle="border-bottom:solid"};
define age / order;

break after age / summarize ;

run;

ods html close;

The OL option's single overline can be simulated by specifying the Border-Top property.

ods html file='temp.html';

proc report data=sashelp.class nowd
style(column)={background=_undef_}
style(report)={rules=none frame=void background=_undef_}
style(header)={background=_undef_}
style(summary)={htmlstyle="border-top:solid"};
define age / order;

break after age / summarize ;

run;

ods html close;

With the OL and UL options combined, you get a single overline and a single underline. You can simulate this by specifying the Border-Top and Border-Bottom properties.

ods html file='temp.html';

proc report data=sashelp.class nowd
style(column)={background=_undef_}
style(report)={rules=none frame=void background=_undef_}
style(header)={background=_undef_}
style(summary)={htmlstyle="border-top:solid;border-bottom:solid"};
define age / order;

break after age / summarize ;

run;

ods html close;

The below example code simulates the HEADLINE option on the PROC REPORT statement. This example adds the Border-Bottom property within the style element HEADER.

ods html file='temp.html';

proc report data=sashelp.class nowd
style(column)={background=_undef_}
style(report)={rules=none frame=void background=_undef_}
style(header)={background=_undef_  htmlstyle="border-bottom:3px solid"};

define age / order;

break after age / summarize ;

run;

ods html close;

The below example code simulates the SPACE= option on the DEFINE statement. This example uses the Padding, Padding-Left, and Padding-Right style properties.

ods html file='temp.html';

proc report data=sashelp.class nowd
style(column)={background=_undef_}
style(report)={rules=none frame=void background=_undef_}
style(header)={background=_undef_}
style(summary)={htmlstyle="border-top:solid;border-bottom:solid"};

define age / order style={htmlstyle="padding-right:10px"};

break after age / summarize ;

run;

ods html close;

The below example code simulates the WIDTH= option on the DEFINE statement. This example uses the CELLWIDTH= property.

ods html file='temp.html';

proc report data=sashelp.class nowd ;
define age / order style={cellwidth=50px};
break after age / summarize ;
run;

ods html close;

The below example colors the borders of any cell that meets the IF condition.

ods html file='temp.html';

proc report data=sashelp.class nowd

style(column)={background=_undef_ }
style(report)={rules=none frame=void  background=_undef_}
style(header)={background=_undef_ };
column name age sex height weight;

define age / order;

compute age;
  if age =12 then call define(_col_,'style','style={htmlstyle="border:solid double green"}');
endcomp;


break after age / summarize ;

run;

ods html close;


The below example specifies a height for any cells that meet the IF condition. The example uses the HEIGHT property within the HTMLSTYLE= attribute.
ods html file='temp.html';

proc report data=sashelp.class nowd;
column sex age  height weight;
title 'Adding height for specific values';
define age / group;
define name / group;
define sex / group;


compute age;
  if age =14 then call define(_col_,'style','style={htmlstyle="height:100px"}');
endcomp;

run;

ods html close

In the HTML destination, the <BR> tag can be inserted into the data to simulate the SPLIT character. In the PDF, RTF, and PS destinations, the hex character '036E'x can be used.

data one;
   x='this line will split <BR> here';
run;

ods html file='temp.html';

proc report data=one nowd;
define x / style(column)={protectspecialchars=off};
run;


ods html close;