simple crossTab

IoT Temperature Binning and Independence Test

Scénario de test & Cas d'usage

Business Context

An industrial manufacturing plant monitors engine temperatures via IoT sensors. The data is continuous, but engineers need to categorize temperatures into 5 distinct 'bins' (ranges) and perform a Chi-Square test to check if the temperature range is statistically independent from the machine's 'Status' (Operational vs. Error).
Data Preparation

Simulation of 5000 sensor readings with continuous Temperature and Status.

Copied!
1 
2DATA casuser.sensors;
3call streaminit(999);
4DO i=1 to 5000;
5Temperature = rand('NORMAL', 80, 15);
6IF Temperature > 100 THEN STATUS='Error';
7ELSE STATUS='Operational';
8OUTPUT;
9END;
10 
11RUN;
12 

Étapes de réalisation

1
Run crossTab with automatic binning (5 bins) on Temperature and Chi-Square test.
Copied!
1 
2PROC CAS;
3SIMPLE.crossTab / TABLE={name='sensors', caslib='casuser'} row='Temperature' col='Status' rowNBins=5 niceBinning=true chiSq=true;
4 
5RUN;
6 

Expected Result


The output should display the 'Temperature' variable grouped into 5 intervals. It must also include the 'ChiSq' table containing the p-value, confirming the strong correlation between high temperature bins and 'Error' status.