table columnInfo

Validation of Customer Data Structure for Campaign Segmentation

Scénario de test & Cas d'usage

Business Context

The Marketing department is preparing a new email campaign. Before running the segmentation algorithm, the Data Scientist needs to verify that the customer dataset ('customers_campaign') contains the expected variable types, specifically ensuring 'LastPurchaseDate' is a date and 'Region' has the correct label, to avoid downstream reporting errors.
About the Set : table

Loading, saving, and managing in-memory tables.

Discover all actions of table
Data Preparation

Creation of a customer table with specific formats and labels.

Copied!
1 
2DATA casuser.customers_campaign;
3LENGTH CustomerName $50 Region $20;
4INPUT CustomerID CustomerName $ Age Region $ LastPurchaseDate :date9.;
5FORMAT LastPurchaseDate date9.;
6label Region='Geographic Sales Region';
7CARDS;
8101 'Alice Brown' 34 'North-East' 15JAN2023 102 'Bob White' 45 'South-West' 28FEB2023 ;
9 
10RUN;
11 

Étapes de réalisation

1
Retrieve metadata for all columns to inspect general structure.
Copied!
1 
2PROC CAS;
3TABLE.columnInfo RESULT=r / TABLE={name='customers_campaign', caslib='casuser'};
4PRINT r;
5 
6QUIT;
7 
2
Retrieve metadata for specific columns ('Region', 'LastPurchaseDate') to validate labels and formats.
Copied!
1 
2PROC CAS;
3TABLE.columnInfo RESULT=r / TABLE={name='customers_campaign', caslib='casuser'} inputs={'Region', 'LastPurchaseDate'};
4PRINT r;
5 
6QUIT;
7 

Expected Result


The first step returns a table listing all 5 columns with their types (double, char). The second step returns a filtered table showing only 'Region' and 'LastPurchaseDate', confirming the label 'Geographic Sales Region' and the format 'DATE9.'.