Thank you so much for the response. I can confirm I have already standardized the data before proc pls. I think it is a great way for us to use the same common data to discuss this statistical problem, since I cannot reveal the data or specific SAS code from the research project to others due to the contract. My research project will use proc pls but the method is rrr instead of pls. The number of response variables are two or three and the number of predictor variables will be about 50. I used the data sashelp.cars similarly with the research project with two response variables (msrp and invoice) and four predictor variables (weight, length, Wheelbase, and MPG_Highway). Based on the following code I wrote, using the data values in data set cars_std, multiplying by the dimension 1 xweight, then adding up across the four (predictor) variables in the model gives me the exact score from proc pls ONLY when method is pls (which is the default method in proc pls as your code indicated. However, this procedure to calculate factor score does not work for method rrr and pcr. Please refer to the following code I have written). Could you help me with this issue? Thanks! /*standardize to mean 0 std 1*/ proc standard data=sashelp.cars out=cars_std mean=0 std=1; var weight length Wheelbase MPG_Highway; run; /*standardized car para*/ data car_std_para; set cars_std (keep=weight length Wheelbase MPG_Highway); id=_n_; run; proc transpose data=car_std_para out=car_std_para prefix=id_; id id; run; proc sort data=car_std_para; by _name_; run; /*proc pls; 3 methods: pcr, rrr, or pls*/ /*factor analysis*/ %macro fa_pls_car (m, nfct, topic); ods listing close; ods output XLoadings=&m._&nfct._xld; ods output XWeights=&m._&nfct._xwt; proc pls data=cars_std method=&m. nfac=&nfct. varss details censcale varscale; title "&topic. (&nfct. factors) based on 4 car parameters"; model msrp invoice=weight length Wheelbase MPG_Highway/solution; output out=car_&m._&nfct. xscore=scorex yscore=scorey; run; ods listing; %mend; %fa_pls_car(pcr,3, Principal components regression); %fa_pls_car(pcr,2, Principal components regression); %fa_pls_car(rrr,2, Reduced rank regression); %fa_pls_car(pls,2, Partial least squares); /*calculate factor score*/ %macro calc_fs_proc_pls_car(m,nfct,v,n); proc transpose data=&m._&nfct._&v.(drop=NumberOfFactors) out=tmp0; run; proc sort data=tmp0; by _name_; run; data tmp1; merge car_std_para tmp0; by _name_; array qt id_1-id_&n.; array score1 sc_1-sc_&n.; do over qt; score1=col1*qt; /*multiply the factor coefficient (xweight) or other stat for factor1 with standardized data (mean 0 std 1)*/ end; run; proc sql; create table tmp2 (keep=fs_:) as select %do i=1 %to &n.; sum(sc_&i.) as fs_&i %if &i. ne &n. %then %do; , %end; %end; from tmp1; quit; proc transpose data=tmp2 out=tmp2; run; data tmp3 (keep=id scorex1); set car_&m._&nfct.; id=_n_; run; data fs_&m._&nfct._&v. (keep=id col1); set tmp2; id=_n_; run; title "&m._&nfct._&v."; proc means data=fs_&m._&nfct._&v.; var col1; run; proc means data=tmp3; var scorex1; run; data diff_fs_&m._&nfct._&v.; merge fs_&m._&nfct._&v. tmp3; by id; length diff_fs_ind $ 20; diff_fs=scorex1-col1; if diff_fs<0.01 then diff_fs_ind="diffrence <0.01"; else diff_fs_ind="diffrence>=0.01"; run; proc freq data=diff_fs_&m._&nfct._&v.; tables diff_fs_ind; run; %mend; /*For each car, the sum of the 4 products btw the factor coefficient ("xweight") and standardized parameter (mean 0 std 1) does not equal to the factor score directly obtained from proc pls when method is pcr or rrr. This calculation only works when method is pls*/ %calc_fs_proc_pls_car(pcr,3,xwt,428); %calc_fs_proc_pls_car(pcr,2,xwt,428); %calc_fs_proc_pls_car(rrr,2,xwt,428); %calc_fs_proc_pls_car(pls,2,xwt,428);
... View more