Contents: | Purpose / Requirements / Usage / Missing Values / See Also / References |
%inc "<location of your file containing the PLS macros>" / nosource;
Following this statement, you may call any if the macros. See the Results tab for an example.
See the individual macro definitions for syntax details on each macro.
McAvoy, T. J., Wang, N. S., Naidu, S., Bhat, N., Gunter, J., and Simmons, M. (1989), "Interpreting Biosensor Data via Backpropagation," International Joint Conference On Neural Networks, 1, 227-233.
Shao, J. (1993), "Linear Model Selection by Cross-Validation," JASA, 88, 486-494.
Tobias, R. (1995), "An Introduction to Partial Least Squares Regression," Proceedings of the Twentieth Annual SAS Users Group International Conference, Cary, NC: SAS Institute Inc., 1250-1257.
Ufkes, J. G. R., Visser, B. J., Heuver, G., and Van Der Meer, C. (1978), "Structure-Activity Relationships of Bradykinin-Potentiating Peptides," European Journal of Pharmacology, 50, 119.
Ufkes, J. G. R., Visser, B. J., Heuver, G., Wynne, H. J., and Van Der Meer, C. (1982), "Further Studies on the Structure-Activity Relationships of Bradykinin-Potentiating Peptides," European Journal of Pharmacology, 79, 155.
Umetrics, Inc. (1995), Multivariate Analysis (3-day course), Winchester, MA.
Wold, S. (1994), "PLS for Multivariate Linear Modeling," QSAR: Chemometric Methods for Molecular Design. Methods and Principles in Medicinal Chemistry. (Ed. H. van de Waterbeemd), Weinheim, Germany: Verlag- Chemie.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
More examples can be found in Examples Using the PLS Procedure
The following example demonstrates how to use a few of the PLS macros to do a basic analysis of a PLS model. To begin with, a PLS model with two factors is fit using PROC PLS. Using the resulting OUT= data set, the %PLOT_SCR macro is called to plot the X- and Y-scores, and the %PLOTXSCR macro is used to plot X-scores for the first and second PLS factors against each other. These plots are used for diagnostic purposes, especially to look for outliers. Plots of Y-scores versus X-scores should have points clustered at random along a line, while the plots of X-scores against each other should look like a random scatter cloud.
Once you examine the score plots and determine that the model fit is adequate, a look at the X-weights will reveal which X-variables are important in each PLS factor. Using the OUTMODEL= data set, the %GET_WTS macro is used to create a SAS data set containing just the X-weights, and the %PLTWTFRQ macro is called to plot the X-weights versus the frequency for each PLS factor, since the X-variables are frequencies in this example.
You can use other macros to analyze other facets of the PLS model. For more detailed examples, including the continuation of this one, see Examples Using the PLS Procedure.
data mswkal; input n OBSNAM $ v1-v27 LS HA DT @@; datalines; 1 EM1 2766 2610 3306 3630 3600 3438 3213 3051 2907 2844 2796 2787 2760 2754 2670 2520 2310 2100 1917 1755 1602 1467 1353 1260 1167 1101 1017 3.011 0 0 2 EM2 1492 1419 1369 1158 958 887 905 929 920 887 800 710 617 535 451 368 296 241 190 157 128 106 89 70 65 56 50 0 0.4005 0 3 EM3 2450 2379 2400 2055 1689 1355 1109 908 750 673 644 640 630 618 571 512 440 368 305 247 196 156 120 98 80 61 50 0 0 90.63 4 EM4 2751 2883 3492 3570 3282 2937 2634 2370 2187 2070 2007 1974 1950 1890 1824 1680 1527 1350 1206 1080 984 888 810 732 669 630 582 1.482 0.158 40 5 EM5 2652 2691 3225 3285 3033 2784 2520 2340 2235 2148 2094 2049 2007 1917 1800 1650 1464 1299 1140 1020 909 810 726 657 594 549 507 1.116 0.4104 30.45 6 EM6 3993 4722 6147 6720 6531 5970 5382 4842 4470 4200 4077 4008 3948 3864 3663 3390 3090 2787 2481 2241 2028 1830 1680 1533 1440 1314 1227 3.397 0.3032 50.82 7 EM7 4032 4350 5430 5763 5490 4974 4452 3990 3690 3474 3357 3300 3213 3147 3000 2772 2490 2220 1980 1779 1599 1440 1320 1200 1119 1032 957 2.428 0.2981 70.59 8 EM8 4530 5190 6910 7580 7510 6930 6150 5490 4990 4670 4490 4370 4300 4210 4000 3770 3420 3060 2760 2490 2230 2060 1860 1700 1590 1490 1380 4.024 0.1153 89.39 9 EM9 4077 4410 5460 5857 5607 5097 4605 4170 3864 3708 3588 3537 3480 3330 3192 2910 2610 2325 2064 1830 1638 1476 1350 1236 1122 1044 963 2.275 0.504 81.75 10 EM10 3450 3432 3969 4020 3678 3237 2814 2487 2205 2061 2001 1965 1947 1890 1776 1635 1452 1278 1128 981 867 753 663 600 552 507 468 0.9588 0.145 101.1 11 EM11 4989 5301 6807 7425 7155 6525 5784 5166 4695 4380 4197 4131 4077 3972 3777 3531 3168 2835 2517 2244 2004 1809 1620 1470 1359 1266 1167 3.19 0.253 120 12 EM12 5340 5790 7590 8390 8310 7670 6890 6190 5700 5380 5200 5110 5040 4900 4700 4390 3970 3540 3170 2810 2490 2240 2060 1870 1700 1590 1470 4.132 0.5691 117.7 13 EM13 3162 3477 4365 4650 4470 4107 3717 3432 3228 3093 3009 2964 2916 2838 2694 2490 2253 2013 1788 1599 1431 1305 1194 1077 990 927 855 2.16 0.436 27.59 14 EM14 4380 4695 6018 6510 6342 5760 5151 4596 4200 3948 3807 3720 3672 3567 3438 3171 2880 2571 2280 2046 1857 1680 1548 1413 1314 1200 1119 3.094 0.2471 61.71 15 EM15 4587 4200 5040 5289 4965 4449 3939 3507 3174 2970 2850 2814 2748 2670 2529 2328 2088 1851 1641 1431 1284 1134 1020 918 840 756 714 1.604 0.2856 108.8 16 EM16 4017 4725 6090 6570 6354 5895 5346 4911 4611 4422 4314 4287 4224 4110 3915 3600 3240 2913 2598 2325 2088 1917 1734 1587 1452 1356 1257 3.162 0.7012 60 17 EM17 3933 4518 5637 6006 5721 5187 4641 4149 3789 3579 3447 3381 3327 3234 3078 2832 2571 2274 2040 1818 1629 1470 1350 1245 1134 1050 987 2.5 0.3 80 18 EM25 2904 2997 3255 3150 2922 2778 2700 2646 2571 2487 2370 2250 2127 2052 1713 1419 1200 984 795 648 525 426 351 291 240 204 162 30 40 150 ; data mswkal_a; set mswkal; if n <= 16; run; /* Define the PLS macros */ %inc "<location of your file containing the PLS macros>" / nosource; %global xvars yvars xscrname yscrname num_x num_y lv; %let xvars=v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 v21 v22 v23 v24 v25 v26 v27; %let yvars=ls ha dt; %let xscrname=xscr; *** Names for scores in output data set ***; %let yscrname=yscr; %let num_y=3; *** Numbers of variables in the data set ***; %let num_x=27; %let lv=2; *** Number of PLS components in model ***; proc pls data=mswkal_a method=pls outmodel=est1 lv=2; model ls ha dt = v1-v27; output out=outpls xscore=xscr yscore=yscr; run; /********************************************************** / Plot Y-scores versus X-scores for each PLS factor / / (both the X- and Y-scores are contained in data set / / OUTPLS) / **********************************************************/ %plot_scr(outpls); /********************************************************** / Plot X-scores for succesive PLS factors against each / / other / **********************************************************/ %plotxscr(outpls); /********************************************************** / Get the X-weights from the OUTMODEL data set EST1 and / / put them into data set XWTS / **********************************************************/ %get_wts(est1,dsxwts=xwts); /********************************************************** / Plot the X-weights vs. the frequencies / **********************************************************/ %pltwtfrq(xwts,plotyvar=w,plotxvar=n,max_lv=&lv,label=Weight);
Right-click on the link below and select Save to save
the PLS macro definitions
to a file. It is recommended that you name the file
pls.sas
.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> PLS |
Date Modified: | 2017-06-20 16:31:32 |
Date Created: | 2005-01-13 15:03:30 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/STAT | z/OS | ||
Z64 | ||||
OpenVMS VAX | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft® Windows® for x64 | ||||
OS/2 | ||||
Microsoft Windows 8 Enterprise 32-bit | ||||
Microsoft Windows 8 Enterprise x64 | ||||
Microsoft Windows 8 Pro 32-bit | ||||
Microsoft Windows 8 Pro x64 | ||||
Microsoft Windows 8.1 Enterprise 32-bit | ||||
Microsoft Windows 8.1 Enterprise x64 | ||||
Microsoft Windows 8.1 Pro | ||||
Microsoft Windows 8.1 Pro 32-bit | ||||
Microsoft Windows 95/98 | ||||
Microsoft Windows 2000 Advanced Server | ||||
Microsoft Windows 2000 Datacenter Server | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows Server 2003 Enterprise Edition | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows Server 2003 for x64 | ||||
Microsoft Windows Server 2008 | ||||
Microsoft Windows Server 2008 R2 | ||||
Microsoft Windows Server 2008 for x64 | ||||
Microsoft Windows Server 2012 Datacenter | ||||
Microsoft Windows Server 2012 R2 Datacenter | ||||
Microsoft Windows Server 2012 R2 Std | ||||
Microsoft Windows Server 2012 Std | ||||
Microsoft Windows XP Professional | ||||
Windows 7 Enterprise 32 bit | ||||
Windows 7 Enterprise x64 | ||||
Windows 7 Home Premium 32 bit | ||||
Windows 7 Home Premium x64 | ||||
Windows 7 Professional 32 bit | ||||
Windows 7 Professional x64 | ||||
Windows 7 Ultimate 32 bit | ||||
Windows 7 Ultimate x64 | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
Windows Vista for x64 | ||||
64-bit Enabled AIX | ||||
64-bit Enabled HP-UX | ||||
64-bit Enabled Solaris | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |