NOMINALDR Procedure

Example 25.1 Dimensionality Reduction with PROC NOMINALDR for Classification

This example illustrates how you can use the NOMINALDR procedure as a preprocessing step to reduce the dimensionality of nominal data for downstream analysis. By transforming high-dimensional nominal data into a lower-dimensional representation, PROC NOMINALDR helps improve computational efficiency while retaining essential patterns in the data. Using a logistic regression model, the example shows that applying this procedure significantly reduces model training time while maintaining comparable accuracy.

The molecularBiology data set, which is derived from molecular biology research, is used in this example. The data set is available from the UCI Machine Learning Repository (1991). You can get the data set from the website at https://archive.ics.uci.edu/dataset/69/molecular+biology+splice+junction+gene+sequences .[6] The data set is split into 80% training and 20% testing sets, which are stored as the comma-separated-value (CSV) files molecularBiologyTrain.csv and molecularBiologyTest.csv, respectively, in the working directory. The following DATA step loads these data sets into your SAS library as Train and Test, respectively:

 proc casutil;
     load file="molecularBiologyTrain.csv" /*or other user-defined location*/
     casout="Train" importoptions=(filetype="CSV" getnames="TRUE");
     load file="molecularBiologyTest.csv" /*or other user-defined location*/
     casout="Test" importoptions=(filetype="CSV" getnames="TRUE");
 run;

The Train and Test data tables consist of 60 nominal input variables (Base1, Base2, …, Base60) and one nominal target variable (class).

In the following statements, PROC NOMINALDR is first applied to the Train data table to reduce the 60 nominal input variables to 10, as specified by the DIMENSION= option. The METHOD= option specifies that the MCA method is to be used in the procedure. The trained model, which is saved as mcaSTORE, is then applied to score the Test data table by using the ASTORE procedure. By default, the statements assume that your libref is named mylib, but you can replace it with any appropriately defined SAS libref.

 proc NOMINALDR data=mylib.Train dimension=10 method=MCA;
     input Base1-Base60 /LEVEL=NOMINAL;
     output out=mylib.mcaTrain copyVars=class;
     savestate RSTORE=mylib.mcaSTORE;
 run;
 proc astore;
     score data=mylib.Test rstore=mylib.mcaSTORE
         out=mylib.mcaTest copyVars=class;
 quit;

Upon completion, the output data tables mcaTrain and mcaTest are generated. They contain the reduced variables along with the target variable (class), as specified by the COPYVARS= option in the OUTPUT statement in PROC NOMINALDR and the SCORE statement in PROC ASTORE.

Similarly, you apply the LPCA method to the Train data table as specified by the METHOD= option and apply the trained LPCA model to score the Test data table, as in the following statements:

 proc NOMINALDR data=mylib.Train dimension=10 method=LPCA m=1;
     input Base1-Base60 /LEVEL=NOMINAL;
     output out=mylib.lpcaTrain copyVars=class;
     savestate RSTORE=mylib.lpcaSTORE;
 run;

 proc astore;
     score data=mylib.Test rstore=mylib.lpcaSTORE
         out=mylib.lpcaTest copyVars=class;
 quit;

The output data tables lpcaTrain and lpcaTest contain the variables that are reduced by the LPCA method, along with the target variable (class).

Logistic regression models are trained on both the original and reduced-dimension data tables to compare their classification performance.

The following LOGISTIC procedure statements train a logistic regression model by using the original nominal data table Train and then evaluate it by using the Test data table. The error rate for the Test data table is shown in Output 25.1.1.

 proc logistic data=mylib.Train;
     class Base1-Base60;
     model class= Base1-Base60 / LINK=GLOGIT;
     score data=mylib.Test fitstat;
     ods output ScoreFitStat=ScoreFitStat;
 run;
 proc print data=ScoreFitStat(keep=MisClass) NOOBS LABEL;
 run;

Output 25.1.1: Error Rate for Model Trained on Original Nominal Data

Error Rate
0.0787


The following statements use PROC LOGISTIC to train a logistic regression model by using the reduced-dimension data table mcaTrain and then evaluate it by using the mcaTest data table. The error rate for the mcaTest data table is shown in Output 25.1.2.

 proc logistic data=mylib.mcaTrain;
     model class=rv1-rv10 / LINK=GLOGIT;
     score data=mylib.mcaTest fitstat;
     ods output ScoreFitStat=ScoreFitStatRVMCA;
 run;
 proc print data=ScoreFitStatRVMCA(keep=MisClass) NOOBS LABEL;
 run;

Output 25.1.2: Error Rate for Model Trained on Reduced-Dimension Data by the MCA Method

Error Rate
0.0677


Another logistic regression model is trained by using the reduced-dimension data table lpcaTrain and then evaluated by using the lpcaTest data table, as in the following PROC LOGISTIC statements. The error rate for the lpcaTest data table is shown in Output 25.1.3.

 proc logistic data=mylib.lpcaTrain;
     model class=rv1-rv10 / LINK=GLOGIT;
     score data=mylib.lpcaTest fitstat;
     ods output ScoreFitStat=ScoreFitStatRVLPCA;
 run;
 proc print data=ScoreFitStatRVLPCA(keep=MisClass) NOOBS LABEL;
 run;

Output 25.1.3: Error Rate for Model Trained on Reduced-Dimension Data by the LPCA Method

Error Rate
0.0551


The original data table contains 60 nominal input variables, and the logistic regression model that is trained on this data table achieves an error rate of 0.0787 on the test set. In contrast, the reduced-dimension data tables, each of which contains only 10 variables, yield lower error rates: 0.0677 when you use the MCA method and 0.0551 when you use the LPCA method. This improvement suggests that eliminating unimportant nominal variables or levels can enhance classification accuracy, because some of them might degrade model performance. The reduced-dimension data table that the LPCA method produces achieves better classification performance (that is, a lower error rate) than the one that the MCA method produces. This might be attributed to the iterative nature of LPCA, which used three iterations on the molecularBiology data set, whereas MCA is noniterative. The iterations enable LPCA to capture more informative structure in the data. As a result, the MCA method is faster, requiring only 0.60 seconds; the LPCA method requires 0.99 seconds.

Regarding training time for the logistic regression models, the training on the original data table, which has 60 nominal input variables, takes 31.65 seconds. In contrast, training on the reduced-dimension data tables, each of which has only 10 variables, is significantly faster: 0.70 seconds for the data table that was reduced by the MCA method, and 0.71 seconds for the data table that was reduced by the LPCA method.

These results demonstrate that both MCA and LPCA can significantly enhance the efficiency of subsequent analysis. This makes each of them a valuable preprocessing technique for working with high-dimensional nominal data, despite a possible minor trade-off in predictive accuracy.



[6] Disclaimer: SAS may reference other websites or content or resources for use at Customer’s sole discretion. SAS has no control over any websites or resources that are provided by companies or persons other than SAS. Customer acknowledges and agrees that SAS is not responsible for the availability or use of any such external sites or resources, and does not endorse any advertising, products, or other materials on or available from such websites or resources. Customer acknowledges and agrees that SAS is not liable for any loss or damage that may be incurred by Customer or its end users as a result of the availability or use of those external sites or resources, or as a result of any reliance placed by Customer or its end users on the completeness, accuracy, or existence of any advertising, products, or other materials on, or available from, such websites or resources.

Last updated: September 23, 2026