SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating Tabular Reports
Specifying Variables


Analysis Variables

Unlike class variables, analysis variables

  • must be numeric
  • are used for arithmetic analysis
  • often contain continuous values.

It makes sense to sum or average analysis variables. For example, you can sum values of Fee to find the total of admission fees paid to the wellness clinic. Or you can average values of Height to find the mean height for all patients admitted.

In the table below, Total (total balance) and BalanceDue (balance due) are analysis variables. Notice that their values are used to compute the numbers appearing in the cells (boxes) of the table.


Total BalanceDue
Sum Mean
$13,079.32 $108.52


As you may have realized, some numeric variables are appropriate as either class or analysis variables. But you specify variables for each PROC TABULATE step separately. This means that the same variable cannot appear in both the CLASS statement and the VAR statement in the same step.

Depending on your table, you may need a CLASS statement, a VAR statement, or both.

     proc tabulate data=stress;
        var resthr maxhr glucose;
        table mean*(maxhr resthr);
     run;
     proc tabulate data=clinic.stress;
        class chol tolerance;
        table chol tolerance all,n;
     run;
     proc tabulate data=clinic.stress;
        class tolerance;
        var glucose;
        table glucose*mean,tolerance;
     run;


Error Messages Related to Specifying Variables

The following error messages occur when you specify variables incorrectly. Look over the messages, in case you encounter any of them during the upcoming practice.


Error Message Meaning
VARIABLE appears in both CLASS and VAR lists. You specified a variable as both class and analysis.
Type of name (VARIABLE) unknown at line n. You forgot to specify a variable as either class or analysis.
Variable VARIABLE in list does not match type prescribed for this list. You specified a character variable as analysis.



back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement