NOMINALDR Procedure
Getting Started: NOMINALDR Procedure
Note: Input data must be in a table that is accessible in your session. You can refer to this table by using a two-level name. The first level is a libref, and the second level is the table name. For more information, see the section Using SAS Viya Workbench in Chapter 2, Shared Concepts.
This example demonstrates how to use the NOMINALDR procedure to reduce the dimensionality of a nominal data table.
The molecularBiology data set, which is derived from molecular biology research, is used in the 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
.[5] The molecularBiology data set includes 60 nominal variables: Base1, Base2, …, Base60. This example demonstrates how to reduce these 60 nominal variables to 10 reduced variables.
Assume that the data set is stored as a comma-separated-value (CSV) file named molecularBiology.csv in the current working directory. The following DATA step loads the data table from the directory into your SAS library by using your libref:
proc casutil;
load file="molecularBiology.csv" /*or other user-defined location*/
casout="molecularBiology"
importoptions=(filetype="CSV" getnames="TRUE");
run;
The following statement uses PROC NOMINALDR to reduce the 60 nominal input variables to 10, as specified by the DIMENSION= option:
proc NOMINALDR data=mylib.molecularBiology dimension=10 method=MCA;
input Base1-Base60 /LEVEL=NOMINAL;
output out=mylib.mcaMolecularBiology;
run;
The METHOD= option specifies that the procedure is to use the MCA method.
When the training is completed, the procedure produces an output data table named mcaMolecularBiology. This table contains the variables that are reduced by the MCA method for all observations.
The following statements print the reduced variables for the first five observations in the mcaMolecularBiology table. The statements assume that your libref is named mylib, but you can substitute any appropriately defined SAS libref. The output is shown in Figure 1.
proc print data=mylib.mcaMolecularBiology(obs=5);
run;
Figure 1: Variables of the First Five Observations Reduced by the MCA Method
| Obs | rv1 | rv2 | rv3 | rv4 | rv5 | rv6 | rv7 | rv8 | rv9 | rv10 |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | -0.017147 | -0.25936 | -0.10532 | 0.04206 | 0.09260 | -0.015206 | -0.00429 | -0.09158 | 0.08327 | 0.09266 |
| 2 | -0.016186 | -0.53011 | -0.35331 | -0.04692 | 0.29795 | 0.030010 | -0.11183 | 0.05915 | 0.01256 | 0.28951 |
| 3 | -0.012715 | -0.33034 | -0.29113 | 0.33252 | -0.13742 | -0.001791 | 0.33437 | -0.16953 | 0.00947 | -0.02099 |
| 4 | -0.019876 | -0.33007 | -0.01995 | 0.27982 | 0.02057 | 0.021704 | -0.05290 | -0.14793 | 0.15868 | 0.44207 |
| 5 | -0.018986 | -0.31486 | -0.23000 | 0.01996 | 0.46719 | 0.061501 | -0.05140 | 0.08693 | 0.03574 | -0.39435 |
Similarly, you can use the LPCA method to reduce the dimensionality of the nominal variables in the molecularBiology data table by using the following statements. The METHOD= option specifies that the procedure is to use the LPCA method. The M= option specifies the approximation of and
.
proc NOMINALDR data=mylib.molecularBiology dimension=10 method=LPCA m=1;
input Base1-Base60 /LEVEL=NOMINAL;
output out=mylib.lpcaMolecularBiology;
run;
The variables that you reduce by using the LPCA method are contained in the lpcaMolecularBiology data table. The following statements print the variables that are reduced by the LPCA method for the first five observations. The results are shown in Figure 2.
proc print data=mylib.lpcaMolecularBiology(obs=5);
run;
Figure 2: Variables of the First Five Observations Reduced by the LPCA Method
| Obs | rv1 | rv2 | rv3 | rv4 | rv5 | rv6 | rv7 | rv8 | rv9 | rv10 |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 2.33976 | 0.44913 | 1.15030 | 0.32812 | 0.55270 | 0.22815 | -0.28483 | 0.02045 | 0.78380 | 3.18420 |
| 2 | 3.55188 | 0.52928 | 3.39016 | -0.89492 | 2.61275 | 0.06044 | 0.72973 | 0.44475 | 2.31191 | -0.41688 |
| 3 | 2.75207 | 0.41207 | 2.97719 | 1.66522 | -2.02575 | 2.18676 | -1.86302 | -0.82404 | -0.15550 | -0.07708 |
| 4 | 2.96910 | 0.37273 | 0.62074 | 1.94794 | -0.35877 | 0.07342 | -0.25042 | -0.66327 | 1.68980 | 0.73484 |
| 5 | 2.26516 | 0.51982 | 2.46082 | 0.13719 | 4.05922 | 0.31809 | -0.01384 | -0.31078 | -2.53159 | 1.34748 |
[5] 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.