Hi,
I am using proc corr with the polyserial option. A coworker and myself are both creating these tables and we are using the same data just sorted differently. When we run the following, we produce different polyserial calculations. Can anyone tell me if the order of the variables in "with" or "var" matter how the polyserial is calculated?
proc sort data=in_dat; by Gender; run;
proc corr data=in_dat outpls=out_dat noprint polyserial (ordinal=with); by Gender; with x; var y; run;
I have a suspicion that there may be some importance to the order, especially if you reverse the variables in the WITH/VAR pair and get different results.
A hint form the documentation in Proc Corr about polyserial
Polyserial correlation measures the correlation between two continuous variables with a bivariate normal distribution, where one variable is observed directly, and the other is unobserved. Information about the unobserved variable is obtained through an observed ordinal variable that is derived from the unobserved variable by classifying its values into a finite set of discrete, ordered values (Olsson, Drasgow, and Dorans 1982).
So the "unobserved" , which ever it might be terms of WITH and VAR would be treated a bit differently in getting the estimate.
Show the different sort codes used and the proc corr.
Best would be to show it from the log with notes about records used.
I responded about the order of the With and Var pairing because your example code does not show any sort involving either of those two variables.
Since the example that you show is not sorting either of the With or Var variables and is using a BY statement then if you sort the data by different variables with different BY statements then I would be extremely surprised to see the same result for almost anything. And since you only show one "example" we really need to see the other to compare.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.