Published on :

Frequency Analysis with PROC FREQTAB and CAS

This code is also available in: Deutsch Español Français
Awaiting validation
The script initializes a CAS session and assigns all available CAS libraries. It then creates a table named `baseball` in the `casuser` library by copying data from the `sashelp.baseball` table. CAS session options are configured to collect performance metrics. Finally, the `PROC FREQTAB` procedure is executed on the `casuser.baseball` CAS table to generate a cross-frequency table for the 'div' and 'team' variables, including chi-square statistics and association measures with their confidence intervals. The CASL action history is also displayed in the SAS© log.
Data Analysis

Type : SASHELP


The data comes from the SASHELP library, `sashelp.baseball`, which is a standard SAS data source.

1 Code Block
DATA STEP Data
Explanation :
This block initializes the CAS session, displays the session reference, assigns all available CASlibs, creates a CAS table named `casuser.baseball` from the `sashelp.baseball` table (which contains baseball data), and configures the CAS session to collect performance metrics via the `sessopts=(metrics=true)` option.
Copied!
1cas;
2%put &_sessref_;
3caslib _all_ assign;
4 
5DATA casuser.baseball;
6 SET sashelp.baseball;
7RUN;
8options sessopts=(metrics=true);
2 Code Block
PROC FREQTAB
Explanation :
This block executes the `PROC FREQTAB` procedure on the `casuser.baseball` CAS table. It generates cross-frequencies for the 'div' and 'team' variables. The `crosslist` option displays frequencies as a list. The `chisq` and `measures(cl)` options request the display of chi-square statistics and association measures with their confidence intervals (CL). The final command `cas &_sessref_ listhistory;` displays the history of CASL actions executed in the SAS log.
Copied!
1PROC FREQTAB DATA=casuser.baseball;
2 TABLE div * team /
3 crosslist chisq measures(cl);
4RUN;
5cas &_sessref_ listhistory;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright © 2021, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. SPDX-License-Identifier: Apache-2.0