Advanced tables and statistics > Dealing with hierarchical data > Analysis levels > Why celllev is preferable to uplev
 
Why celllev is preferable to uplev
Use celllev in preference to uplev=, except when you need to use levbase, which is not available for celllev. This is because uplev= sometimes gives misleading results.
For example, suppose you are working on a shopping survey that has two levels, person and shop. The data in the shop level indicates which flavors of yogurt the respondent bought in each shop, and you need to create a table of flavor by store at person level. The cell for banana yogurt bought in Safeway must show the number of people buying banana yogurt in Safeway at least once, not the total number of times banana yogurt was bought in Safeway by every person interviewed.
Using uplev=, you would specify the table as:
tab flav store;anlev=person
l flav;anlev=person;uplev=shop
    .
l store;anlev=person;uplev=shop
However, the table that this creates shows that this does not produce the figures you want. If you take just one person as follows:
Safeway – Banana, Strawberry, Mango
Sainsbury – Banana, Peach, Strawberry
the table will look like this:
 
 Base
Safeway
Sainsbury
Base
    1
    1
     1
Banana
    1
    1
     1
Strawberry
    1
    1
     1
Mango
    1
    1
     1
Peach
    1
    1
     1
      .
 
 
 
There is one person who bought a variety of flavors in both shops, but you cannot see exactly which flavor was bought where. This is because uplev takes all answers and β€˜ors’ them together before the axes are combined in the table.
However if use celllev to specify the table:
tab flav store;anlev=shop;celllev=person
l flav;anlev=shop
    .
l store;anlev=shop
For the same respondent, the table becomes:
 
 Base
Safeway
Sainsbury
Base
    1
    1
     1
Banana
    1
    1
     1
Strawberry
    1
    1
     1
Mango
    1
    1
     0
Peach
    1
    0
     1
        .
 
 
 
You can now see that one person who bought banana and strawberry yogurts in both Safeway and Sainsbury, mango yogurt in Safeway and peach yogurt in Sainsbury. Giving the axes and the tab statement the same analysis level and updating the table with celllev forces Quantum to retain the relationship between the flavor and store data for each person.
If you want a table that just shows the number of times each flavor was bought in each store (that is, a straightforward table of flavor by store), use anlev=shop on the tab and l  statements, and ignore celllev and uplev.
See also
Analysis levels