Sample 23847: How to have the rows of PROC TABULATE output to appear in the order that their formatted values appear in PROC FORMAT
In order to have the rows of your PROC TABULATE output to appear in the order that their formatted values appear in your PROC FORMAT code, you will need to add the NOTSORTED option to the VALUE statement with PROC FORMAT. In addition, specify the ORDER=DATA option in the PROC TABULATE statement.
The sample code on the Full Code tab demonstrates using the NOTSORTED option with PROC FORMAT, as well as the PRELOADFMT option in the CLASS statement of PROC TABULATE.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample code illustrates how to have the rows of your PROC TABULATE output to appear in the order that their formatted values appear in PROC FORMAT.
proc format;
value $weekd (notsorted) 'monday'='Monday'
'tuesday'='Tuesday'
'wednesday'='Wednesday'
'thursday'='Thursday'
'friday'='Friday';
data test;
input dayofweek $10. @12 sales 5.;
datalines;
monday 10000
tuesday 20000
thursday 15000
friday 12000
;
run;
proc tabulate data=test order=data;
class dayofweek / preloadfmt;
format dayofweek $weekd.;
var sales;
table dayofweek all, sales all / printmiss misstext='0';
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
This sample illustrates how to have the rows of your PROC TABULATE output to appear in the order that their formatted values appear in PROC FORMAT.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> TABULATE
|
Date Modified: | 2011-01-24 10:23:58 |
Date Created: | 2004-03-11 10:23:01 |
Operating System and Release Information