BookmarkSubscribeRSS Feed
HN2001
Obsidian | Level 7

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;

3 REPLIES 3
ballardw
Super User

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.

 

 

HN2001
Obsidian | Level 7
Let me clarify what I originally asked. I know we have the with and var variables correct. What I am asking is if the sort order of the variable in with and the sort order of the variable in var matters?

We are working with the same data just sorted differently and are producing different polyserial values and can't figure out why
ballardw
Super User

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1076 views
  • 0 likes
  • 2 in conversation