Thursday, 31 January 2013

What is the significance of _type_ in proc means and proc summary?

 What is the significance of _type_ in proc means and proc summary?

Suppose we are running this code
PROC SUMMARY;
CLASS A B;
VAR TOTAL;
OUTPUT OUT = TWOVAR
SUM=SUMTOTAL;
RUN;

In this way.................

_TYPE_= 0 All records
_TYPE_= 1 Records summarized by B only.
_TYPE_= 2 Records summarized by A only.
_TYPE_= 3 Records summarized by both A and B.


Now add a 3rd Variable:

PROC SUMMARY;
CLASS A B C;
VAR TOTAL;
OUTPUT OUT = THREEVAR
SUM=SUMTOTAL;
RUN;

Now......
_TYPE_= 0 All records
_TYPE_= 1 Records summarized by C only.
_TYPE_= 2 Records summarized by B only.
_TYPE_= 3 Records summarized by both B and C.
_TYPE_= 4 Records summarized by A only.
_TYPE_= 5 Records summarized by A and C only.
_TYPE_= 6 Records summarized by A and B only.
_TYPE_= 7 Records summarized by A and B and C.

4 comments: