Generates a frequency distribution for one or more variables. It calculates counts, percentages, cumulative counts, and cumulative percentages for the unique values of the specified input variables. This action is fundamental for summarizing categorical data and understanding value distributions.
| Parameter | Description |
|---|---|
| table | Specifies the input table name, library, and optional settings such as group-by variables, computed variables, and filtering (where clause). |
| inputs | Specifies the list of variables to analyze. If not specified, all numeric and character variables are analyzed. |
| casOut | Specifies the output table where the frequency results will be stored. Includes options for compression, replication, and memory format. |
| includeMissing | When set to True, missing values are treated as a valid level and included in the frequency counts and percentage calculations. |
| descending | When set to True, sorts the levels of the variables (and group-by variables) in descending order. |
| raw | When set to True, uses the raw unformatted values of the variables for analysis rather than formatted values. |
| groupByLimit | Sets a limit on the number of unique group-by keys. If the limit is exceeded, the action stops to prevent excessive output size. |
| writePartOnTheFly | When set to True, writes results to the output table immediately after processing each BY-group, useful for very large tasks. |
Loads the 'cars' dataset from the SASHELP library into the 'casuser' CAS library for analysis.
| 1 | DATA casuser.cars; SET sashelp.cars; RUN; |
Calculates the frequency distribution for the 'Type' variable (e.g., SUV, Sedan) in the cars table.
| 1 | |
| 2 | PROC CAS; |
| 3 | SIMPLE.freq / TABLE={name="cars", caslib="casuser"} inputs={"Type"}; |
| 4 | |
| 5 | RUN; |
| 6 |
Calculates frequencies for the 'Origin' variable, grouped by car 'Type'. Missing values are included, and the results are saved to a CAS table named 'freq_results'.
| 1 | |
| 2 | PROC CAS; |
| 3 | SIMPLE.freq / TABLE={name="cars", caslib="casuser", groupBy={"Type"}} inputs={"Origin"} includeMissing=true casOut={name="freq_results", caslib="casuser", replace=true}; |
| 4 | |
| 5 | RUN; |
| 6 |