Troubleshooting

Understanding and Resolving the "Type of name is unknown" Error in PROC TABULATE

Simon 6 Aufrufe

When creating summary reports with SAS© (whether via SAS© Data Integration Studio or in Base SAS© code), the PROC TABULATE procedure is a powerful tool. However, it is common to encounter a blocking error message when submitting the job, which looks like this:

ERROR: The type of name (nom_de_variable) is unknown.

The first instinct is often to think of a software bug or a missing hotfix. However, in the vast majority of cases, it is a fundamental syntax problem related to the logic of PROC TABULATE.

Illustration

The Golden Rule: CLASS vs VAR

The Golden Rule: CLASS vs VAR

To understand the error, you need to understand how SAS© processes data in this procedure. Unlike other procedures, PROC TABULATE requires that every variable mentioned in the TABLE statement be previously defined.

SAS© needs to know how to process the variable:

  1. Is it a classification variable that will create rows or columns?

  2. Is it a numeric variable on which statistics (sums, averages) will be calculated?

If a variable appears in the TABLE statement without being declared, SAS© does not know its usage "type", hence the "unknown" error.

The Solution

To fix this problem, you must define the usage of your variables using the CLASS and VAR statements.

  • The CLASS statement: Use it for categorical variables (e.g., Department, Course Name, Section). These are the variables that create the "buckets" or groupings.

  • The VAR statement: Use it for analysis variables (e.g., Total Cost, Salary). These are the variables on which calculations are performed.

Concrete Example

Let's imagine you want to create a table crossing the course name with the department, section, and total cost.

The incorrect code (which generates the error):

1PROC TABULATE DATA=ma_table;
2 /* Erreur : SAS ne sait pas ce que sont course_name, department, etc. */
3 TABLE course_name, department*section*tot_cost;
4RUN;

The corrected code:

Here, we define course_name, department, and section as classification variables, and tot_cost as the analysis variable.

1PROC TABULATE DATA=ma_table;
2 /* Déclaration des variables de classification (catégories) */
3 class course_name department section;
4
5 /* Déclaration de la variable d'analyse (chiffres) */
6 var tot_cost;
7
8 /* La table peut maintenant être générée */
9 TABLE course_name, department*section*tot_cost;
10RUN;

Before contacting technical support or looking for a software patch, always check your syntax. If you use a variable in your table structure (TABLE), make sure it is listed in either the CLASS statement or the VAR statement.