Firstly, I just started using SAS two weeks ago. Apologies if this question is basic. Secondly, I am using Enterprise Guide 7.1. Thirdly, I am not getting errors. I am trying to correlate four independent variables (IV) agaisnt a depedent variable (DV). I know that the independent variables have zeroes and I don't want to include those values when the Pearson correlation coefficients are calculated. The dependent variable contains only non negative rational numbers, and so do the independent variables (include zeroes though). This is what I am running: ODS GRAPHICS ON; PROC SORT
DATA=WORK.mf15126(KEEP= DV IV1 IV2 IV3 IV4 ProductCode)
OUT=WORK.SORTTempTableSorted
;
BY ProductCode;
RUN;
PROC CORR DATA=WORK.SORTTempTableSorted
PLOTS=SCATTER
PEARSON
EXCLNPWGT
VARDEF=DF
;
BY ProductCode;
WHERE ProductCode eq "blah";
VAR DV;
WITH IV1 IV2 IV3 IV4;
RUN; That spits some values. But when I try the same code without EXCLNPWGT, the correlation coefficients are the same. Also, the scatterplot shows me that SAS is considering zeros for the IVs for the plotting. I the went to R, separated all my DV, IV pairs into different dfs, then drop rows with zeroes, then run the corr function, and the results were different. Can someone please tell me if I am doing something wrong in the code (or if I am not using the proc corr the way I am supposed to)? Thank you!
... View more