Hi,
By independently, I mean if I use proc rank to output 4 ranks based on Uvalue, I do not consider Svalue. And vice versus if I output based on Svalue.
After the two sorts are done,
I expect 4 ranks within each variable category. 4*4 =16 cells,
My goal is to test whether Dvalue differs significantly within each cell.
2. That is does Dvalue in (Quartile 1 based on Uvalue rank) is significantly different from Dvalue in Quartile 1 based on Dvalue rank.
I know how to single sort, but need your help with double sort, and save the output for T-test in part 2.
thanks!
Lan
| firmid | year | Uvalue | Svalue | Dvalue |
| 1001 | 1992 | 0.3 | 10 | 100 |
| 1001 | 1993 | 0.6 | 11 | 90 |
| 1001 | 1994 | 1 | 11 | 90 |
| 1001 | 1995 | 0.9 | 12 | 100 |
| 1001 | 1996 | 1.1 | 12 | 110 |
| 1001 | 1997 | 0.92 | 12 | 110 |
| 1001 | 1998 | 1.1 | 13 | 111 |
| 1002 | 1993 | 0.2 | 9 | 20 |
| 1002 | 1994 | 0.3 | 9 | 22 |
| 1002 | 1995 | 0.4 | 9.1 | 23 |
| 1002 | 1996 | 0.9 | 10 | 25 |
| 1002 | 1997 | 0.7 | 10 | 30 |
| 1003 | 1995 | 1 | 6 | 15 |
| 1003 | 1996 | 1.1 | 5 | 15 |
| 1003 | 1997 | 1.4 | 7 | 16 |
Proc RANK does its own sorting for each variable. You don't have to worry about it. So the answer to your first question is straightforward. The second question however isn't valid statistically as the two sets that you want to compare are not independent. I would simply look at the frequency and Dvalue mean for each combination of quartiles :
proc rank data=have out=haveQuart groups=4;
var Uvalue Svalue;
ranks Uquart Squart;
run;
proc means data=haveQuart n mean nonobs printaltypes;
class Uquart Squart;
var Dvalue;
run;
PG
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.