Discussion:
Can I use width= and cellwidth= at the same time for "proc report"
(too old to reply)
RolandRB
2008-04-10 09:51:23 UTC
Permalink
Can I use width= and cellwidth= at the same time for "proc report"?
Has anyone tried this? I want to make my reporting macros more ODS
friendly and I want them to be able to produce standard listings and
ODS HTML tabular output at the same time and control the column width
for both.
RolandRB
2008-04-10 11:23:54 UTC
Permalink
Post by RolandRB
Can I use width= and cellwidth= at the same time for "proc report"?
Has anyone tried this? I want to make my reporting macros more ODS
friendly and I want them to be able to produce standard listings and
ODS HTML tabular output at the same time and control the column width
for both.
I'm trying this now running under v8.2 and am getting some strange
results.

If I run the following code I get a narrow html table.

ods html file="C:\spectre\cellw.html";
proc report nowd data=sashelp.class;
columns name sex age height weight;
define name / width=10 style(column)=[cellwidth=20%];
define sex / width=10 style(column)=[cellwidth=10%];
define age / width=10 style(column)=[cellwidth=20%];
define height / width=10 style(column)=[cellwidth=20%];
define weight / width=10 style(column)=[cellwidth=20%];
run;
ods html close;

But if I run this code I get a wide html table,

ods html file="C:\spectre\cellw.html";
proc report nowd data=sashelp.class;
columns name sex age height weight;
define name / width=10 style(column)=[cellwidth=10%];
define sex / width=10 style(column)=[cellwidth=5%];
define age / width=10 style(column)=[cellwidth=10%];
define height / width=10 style(column)=[cellwidth=10%];
define weight / width=10 style(column)=[cellwidth=10%];
run;
ods html close;

Can somebody explain to me why this should be?
RolandRB
2008-04-10 11:53:16 UTC
Permalink
Post by RolandRB
Post by RolandRB
Can I use width= and cellwidth= at the same time for "proc report"?
Has anyone tried this? I want to make my reporting macros more ODS
friendly and I want them to be able to produce standard listings and
ODS HTML tabular output at the same time and control the column width
for both.
I'm trying this now running under v8.2 and am getting some strange
results.
If I run the following code I get a narrow html table.
ods html file="C:\spectre\cellw.html";
proc report nowd data=sashelp.class;
columns name sex age height weight;
define name / width=10 style(column)=[cellwidth=20%];
define sex / width=10 style(column)=[cellwidth=10%];
define age / width=10 style(column)=[cellwidth=20%];
define height / width=10 style(column)=[cellwidth=20%];
define weight / width=10 style(column)=[cellwidth=20%];
run;
ods html close;
But if I run this code I get a wide html table,
ods html file="C:\spectre\cellw.html";
proc report nowd data=sashelp.class;
columns name sex age height weight;
define name / width=10 style(column)=[cellwidth=10%];
define sex / width=10 style(column)=[cellwidth=5%];
define age / width=10 style(column)=[cellwidth=10%];
define height / width=10 style(column)=[cellwidth=10%];
define weight / width=10 style(column)=[cellwidth=10%];
run;
ods html close;
Can somebody explain to me why this should be?
Well, seeing as using cellwidth percentages DOES NOT WORK then what is
the best way of setting cell width for html output based on the
listing column widths? Multiplying it by 8 and using points (pt),
perhaps, and maybe having this factor of 8 adjustable? Has anyone
waded into this mess and come out of it with a good solution?

The SI should use me as a tester. Anything they put in their software
that is off the beaten track fails straightaway for me, first time
every time.
RolandRB
2008-04-10 13:13:15 UTC
Permalink
Post by RolandRB
Post by RolandRB
Post by RolandRB
Can I use width= and cellwidth= at the same time for "proc report"?
Has anyone tried this? I want to make my reporting macros more ODS
friendly and I want them to be able to produce standard listings and
ODS HTML tabular output at the same time and control the column width
for both.
I'm trying this now running under v8.2 and am getting some strange
results.
If I run the following code I get a narrow html table.
ods html file="C:\spectre\cellw.html";
proc report nowd data=sashelp.class;
columns name sex age height weight;
define name / width=10 style(column)=[cellwidth=20%];
define sex / width=10 style(column)=[cellwidth=10%];
define age / width=10 style(column)=[cellwidth=20%];
define height / width=10 style(column)=[cellwidth=20%];
define weight / width=10 style(column)=[cellwidth=20%];
run;
ods html close;
But if I run this code I get a wide html table,
ods html file="C:\spectre\cellw.html";
proc report nowd data=sashelp.class;
columns name sex age height weight;
define name / width=10 style(column)=[cellwidth=10%];
define sex / width=10 style(column)=[cellwidth=5%];
define age / width=10 style(column)=[cellwidth=10%];
define height / width=10 style(column)=[cellwidth=10%];
define weight / width=10 style(column)=[cellwidth=10%];
run;
ods html close;
Can somebody explain to me why this should be?
Well, seeing as using cellwidth percentages DOES NOT WORK then what is
the best way of setting cell width for html output based on the
listing column widths? Multiplying it by 8 and using points (pt),
perhaps, and maybe having this factor of 8 adjustable? Has anyone
waded into this mess and come out of it with a good solution?
The SI should use me as a tester. Anything they put in their software
that is off the beaten track fails straightaway for me, first time
every time.- Hide quoted text -
- Show quoted text -
OK, so cellwidth=int% DOES WORK but only if you set
style(report)=[outputwidth=...]. This important snippet was somehow
missing from the SI award-winning documentation.

So here is how I can solve the problem. Let the user specify
outputwidth as a percentage and since I know the report width in
columns inside my reporting macro plus the width of the individual
columns then I can calculate the integer percentage of the column
width as a fraction of the report width and I do this for all columns
bar one which will soak up the spare percentage to sum to 100%.

Here is some code I was playing around with.

ods listing close;
ods html file="C:\spectre\cellw.html";
proc report nowd data=sashelp.class style(report)=[outputwidth=90%];
columns name sex age height weight;
define name / width=10 style(column)=[cellwidth=23%];
define sex / width=5 ;
define age / width=10 style(column)=[cellwidth=23%];
define height / width=10 style(column)=[cellwidth=23%];
define weight / width=10 style(column)=[cellwidth=23%];
run;
ods html close;
ods listing;

Loading...