```Date: Thu, 7 Jan 2010 21:13:47 -0500 Reply-To: Francois van der Walt Sender: "SAS(r) Discussion" From: Francois van der Walt Subject: Re: Create an HTML report from this dataset Comments: To: Lorne Klassen Hi Lorne, If this was the result you envisage: ***************************************************************************************** * * year * * ****************************************************************** * * 95 * 96 * 97 * 98 * 99 * * ****************************************************************** * * count * count * count * count * count * * ****************************************************************** * * Sum * Sum * Sum * Sum * Sum * ***************************************************************************************** *car * * * * * * ************************ * * * * * *Ferrari * 0.00* 0.00* 0.00* 0.00* 0.00* ***************************************************************************************** *Honda * 5.00* 15.00* 5.00* 0.00* 0.00* ***************************************************************************************** *Mercedes * 5.00* 0.00* 0.00* 0.00* 5.00* ***************************************************************************************** *Toyota * 0.00* 0.00* 5.00* 5.00* 5.00* ***************************************************************************************** Here is the code: data cars; input @1 car \$10. @11 year 5. @19 count 5.; datalines; 50 95 10 96 15 97 10 98 5 99 10 Ferrari 0 Ferrari 95 0 Ferrari 96 0 Ferrari 97 0 Ferrari 98 0 Ferrari 99 0 Honda 25 Honda 95 5 Honda 96 15 Honda 97 5 Honda 98 0 Honda 99 0 Mercedes 10 Mercedes 95 5 Mercedes 96 0 Mercedes 97 0 Mercedes 98 0 Mercedes 99 5 Toyota 15 Toyota 95 0 Toyota 96 0 Toyota 97 5 Toyota 98 5 Toyota 99 5 ; * The formchar was just to use to create table for the SAS-L forum. proc tabulate data=cars /* formchar(1,2,3,4,5,6,7,8,9,10,11) ='***********'*/; class car year; var count; table car,year*count*sum; run; On Wed, 6 Jan 2010 20:19:19 -0500, Lorne Klassen wrote: >I need to generate an easy to read report from a dataset that has anywhere >from 1-5 class variables and a count variable. The count totals to be put >in the report are also included in this dataset. I've been told that THESE >TOTALS MUST BE PRESENTED AS THEY ARE IN THE DATASET. TOTALS CANNOT BE RE- >CALCULATED BY A SAS PROC (since they may not always be the same as the >totals in the dataset which have been tinkered with previously by a >rounding algorithm). > >Below is an example of a dataset. This dataset has 2 class variables (i.e. >2 dimensions) Car and Year. There could be as many as 5 class variables. >Where a variable is missing, this represents "ALL" or the total for that >variable. > >The report doesn't have to have any particular layout style. But it has to >be more presentable than what a simple PROC PRINT would produce. >Preferably, it would have a crosstab layout like FREQ or TABULATE would >produce. I can easily get PROC PRINT to generate a report but it looks just >like the dataset. Something more readable is required. > >Is there a way to do this with PROC REPORT ? PROC FREQ ? PROC TABULATE ? A Hi >DATA _NULL_ step ? The output will be to an HTML file. > >Thanks > > >Car Year Count >--- ---- ----- > 50 > 95 10 > 96 15 > 97 10 > 98 5 > 99 10 >Ferrari 0 >Ferrari 95 0 >Ferrari 96 0 >Ferrari 97 0 >Ferrari 98 0 >Ferrari 99 0 >Honda 25 >Honda 95 5 >Honda 96 15 >Honda 97 5 >Honda 98 0 >Honda 99 0 >Mercedes 10 >Mercedes 95 5 >Mercedes 96 0 >Mercedes 97 0 >Mercedes 98 0 >Mercedes 99 5 >Toyota 15 >Toyota 95 0 >Toyota 96 0 >Toyota 97 5 >Toyota 98 5 >Toyota 99 5 ```

Back to: Top of message | Previous page | Main SAS-L page