countreg countregFitModel

Defect Analysis with Missing Sensor Data and Lasso Selection

Scénario de test & Cas d'usage

Business Context

A manufacturing plant tracks defects per batch. However, sensors often fail, leading to missing values (NULLs) in the temperature and pressure readings. The team wants to use LASSO selection to find the most critical factors despite the data quality issues.
Data Preparation

Creation of a dataset with random missing values (NULL) in predictor variables to test robustness.

Copied!
1 
2DATA mycas.mfg_defects;
3call streaminit(456);
4DO batch = 1 to 500;
5Temperature = rand('NORMAL', 100, 10);
6IF rand('UNIFORM') < 0.1 THEN Temperature = .;
7Pressure = rand('NORMAL', 50, 5);
8IF rand('UNIFORM') < 0.05 THEN Pressure = .;
9Defects = rand('POISSON', exp(0.02 * (ifn(Temperature=., 100, Temperature)) - 0.01 * Pressure));
10OUTPUT;
11END;
12 
13RUN;
14 

Étapes de réalisation

1
Attempt variable selection (LASSO) with missing values in regressors and save the model.
Copied!
1 
2PROC CAS;
3countreg.countregFitModel / TABLE={name='mfg_defects'} model={depVars={{name='Defects'}}, effects={{vars={'Temperature', 'Pressure'}}}, modeloptions={modeltype='POISSON'}} selection={method='LASSO'} store={name='defect_model_store', replace=true};
4 
5RUN;
6 
2
Verify that the model store was created despite the missing values (observations with missing values should be dropped or handled).
Copied!
1 
2PROC CAS;
3TABLE.fileInfo / path='defect_model_store.sashdat';
4 
5RUN;
6 

Expected Result


The action completes successfully. Observations with missing values in 'Temperature' or 'Pressure' are excluded from the analysis (standard SAS behavior), but the process does not crash. The 'defect_model_store' is successfully created for future scoring.