Saturday, November 1, 2008

Y FREQ ??? use MEANS...

-
No dummy dataset... No data doubling...

“Making of Table” has become much simpler using PROC MEANS procedure! PROC MEANS when used in combination with MULTILABEL format and PRELOADFMT option gives all possible values of a formatted variable.

For example: If there are two different treatment groups (1 & 2) in a table and if the third column has to display a total count of both the treatment groups (1+2), then the MULTILABEL format is used.
-
proc format;
value $tmt (multilabel)
'1'='trt1'
'2'='trt2'
'1','2' = 'Total';
run;
-
This option allows the user to define:
  • overlapping ranges across labels and to
  • assign another label to the same value

This format is very efficient when used in conjunction with the means procedure TO PRODUCE THE TOTAL COUNT. Not only the multilabel format but also the use of PRELOADFMT with COMPLETETYPES enhances the efficiency of a program in CREATING ALL POSSIBLE COMBINATIONS OF A VARIABLE.

Now let’s consider three different categories (‘MILD’, ‘MODERATE’ & 'SEVERE') for a variable AEREL and if the dataset does not contain one of the category (‘MODERATE’) and if this same category has to be displayed in the table, then the PRELOADFMT option is used [as it gives instruction to load the FORMAT for the missing category ‘MODERATE’].
-
proc format;
value $rel
'MILD' = 'Mild'
‘MODERATE’ = 'Moderate'
'SEVERE' = 'Severe'
' ' = 'Missing';
run;
-
*USE OF PROC MEANS WITH MULTILABEL & PRELOADFMT;
-
proc means data=test completetypes nway chartype missing noprint;
by visit;
class treat aerel/preloadfmt missing mlf order=formatted;
format treat $tmt. aerel $rel.;
output out=cnt1 n=ccnt;
run;
-
-