Date: Thu, 21 Jun 2007 12:24:26 -0400
Reply-To: Ken Borowiak <EvilPettingZoo97@AOL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ken Borowiak <EvilPettingZoo97@AOL.COM>
Subject: Re: Tabulate preloadfmt question
On Thu, 21 Jun 2007 11:46:52 -0400, Richard A. DeVenezia
<rdevenezia@WILDBLUE.NET> wrote:
>I was under the impression preloadfmt would cause all class level values to
>appear in a tabulate, even when the data did not contain some of the class
>level values.
>
>In this sample code I am wondering why there is not a 'No' column and not a
>'Row 2'
>
>-------------------------------------------------
>filename report "%sysfunc(pathname(WORK))\report.html";
>
>ods html file=report style=meadow;
>
>proc format;
> value X 1='One one one';
> value RH 1='Row one' 2='Row two' 3='Row three' 4='Row four';
> value RC 1='Yes' 2='No';
>run;
>
>data foo;
> X = 1;
> do rowid = 1 to 100;
> rowheader = ceil(4*ranuni(1234));
> colheader = 1; * everything is yes;
> if rowheader ne 2 then
> output;
> end;
> format rowheader RH. colheader RC. X X.
>run;
>
>proc tabulate data=foo;
> by X;
> class rowheader / order=data preloadfmt;
> class colheader / order=data preloadfmt missing;
> table rowheader, (colheader all)*N='';
> label rowheader='These are the rows';
> label colheader='These are the columns';
>run;
>
>ods html close;
>-------------------------------------------------
>
>Richard A. DeVenezia
>http://www.devenezia.com/
Richard,
Had you specified ORDER=FORMATTED for COLHEADER, you would have received a
warning:
WARNING: PreloadFmt will have no effect on the output without one of the
following options: "printmiss","order=data", or the class statement
option "exclusive".
Why this warning was not displayed when ORDER=DATA was specified seems very
odd. In any event, adding PRINTMISS seems to address the issue.
HTH,
Ken
|