The freqTab action in the Frequency and Crosstabulation Analysis action set constructs frequency and crosstabulation tables. It functions similarly to the FREQ procedure in SAS, allowing users to produce one-way to n-way frequency and contingency tables. It provides counts, percentages, and cumulative statistics, and supports options for handling missing values, weighting, and ordering results.
| Parameter | Description |
|---|---|
| table | Specifies the input table settings, including the table name and CAS library. |
| tabulate | Specifies the variables for the analysis. Use the 'vars' subparameter for the primary variables and 'cross' for variables to crosstabulate against. |
| weight | Specifies a numeric variable to use as a weight for each observation. |
| order | Determines the sort order of the variable levels: 'FORMATTED' (default), 'FREQ' (by descending count), or 'INTERNAL' (unformatted value). |
| descending | If set to True, reverses the sort order specified by the 'order' parameter. |
| includeMissing | If set to True, missing values are treated as a valid level in the frequency tables. |
| outputTables | Lists the names of the result tables to save to the server. |
| tabDisplay | Controls the format of the output tables, such as using 'CROSSLIST' or 'LIST' format for crosstabulations. |
Loads the 'cars' dataset from the SAS help library into the CAS session.
| 1 | DATA casuser.cars; SET sashelp.cars; RUN; |
Calculates the frequency distribution for the 'Type' variable in the cars table.
| 1 | |
| 2 | PROC CAS; |
| 3 | freqTab.freqTab / TABLE={name="cars"} tabulate={{vars={"Type"}}}; |
| 4 | |
| 5 | RUN; |
| 6 |
Produces a crosstabulation of 'Origin' by 'Type', sorting results by frequency descending, including missing values, and weighing by 'Invoice'.
| 1 | |
| 2 | PROC CAS; |
| 3 | freqTab.freqTab / TABLE={name="cars"} weight="Invoice" order="FREQ" includeMissing=true tabulate={{vars={"Origin"}, cross={"Type"}}} tabDisplay={FORMAT="CROSSLIST"}; |
| 4 | |
| 5 | RUN; |
| 6 |