BookmarkSubscribeRSS Feed
chittamsri1_gmail_com
Calcite | Level 5

In summary procedure if we have more than 2 variables how we will get '_type_' in output 

in the below example we have two variables 'region & schedule'

_type_ = 0  - grand total or overall analysis with out use of two variables (region & schedule)

_type_=1  - analysis is done by using region and with out use of schedule

_type_=2 -  analysis is done by using schedule and with out use of region

_type_=3  -  analysis is done by using schedule and region

Obs  REGION schedule _TYPE_ _FREQ_ Mean Sum Median

1 0 5645 5504.87 31003426 4731.0

2 E1L 1 452 4620.81 2088608 4209.5

3 WESTERN 2 4955 5368.26 26529952 4633.0

4 SOUTHERN E1 3 556 6781.49 3770511 6175.0

7 REPLIES 7
data_null__
Jade | Level 19

With three CLASS variable the value of _TYPE_ will range from 0 to 7.  000,001,010,011,100,101,110,111

I think it is easier to understand and use _TYPE_ is you use the PROC SUMMARY statement option CHARTYPE.  Then _TYPE_ becomes a character variable with length equal to the number of CLASS variables where each byte is 0 or 1.  The ith CLASS variable corresponding to the ith byte of _TYPE_.  When the ith byte is 1 the observation includes the ith CLASS variable, when 0 no.

Reeza
Super User

I'm not sure how it decides which is type 1 and then type 2.

However, you can control the levels you get with the WAYS statement.

data_null__
Jade | Level 19

The order of the variables in the CLASS statement(s) determines the order of the bits in a numeric _TYPE_ or byte in a character _TYPE_

CLASS   A B C;
_type_
0       0 0 0
1       0 0 1
2       0 1 0
3       0 1 1
4       1 0 0
5       1 0 1
6       1 1 0
7       1 1 1
ballardw
Super User

Look at the order of your class variables. That determines how the _type_ combinations are set.

You get first, _type_ =0 for all data, then depending on the number of class variables, the summary of each class variable only, then the pairs, then the three-at-a-time, then four-at-a-time... to the combinations of all class variables.

data_null__
Jade | Level 19

ballardw wrote:

Look at the order of your class variables. That determines how the _type_ combinations are set.

You get first, _type_ =0 for all data, then depending on the number of class variables, the summary of each class variable only, then the pairs, then the three-at-a-time, then four-at-a-time... to the combinations of all class variables.

_TYPE_ does not order by _WAY_

_type_ _way_
0000     0
0001     1
0010     1
0011     2
0100     1
0101     2
0110     2
0111     3
1000     1
1001     2
1010     2
1011     3
1100     2
1101     3
1110     3
1111     4
RichardinOz
Quartz | Level 8

Another option is to use the TYPES statement which allows specification of subtotals by required combinations of class variables without having to specify values of _TYPE_.

Base SAS(R) 9.2 Procedures Guide

Richard

Tom
Super User Tom
Super User

For the _TYPE_ values you describe your CLASS statement must have been:

CLASS SCHEDULE REGION ;

The last class variable is used for the least significant bit of the _TYPE_ value.  So odd values of _TYPE_ will include REGION as it is last variable listed in the CLASS statement.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 857 views
  • 1 like
  • 6 in conversation