Hello, can anyone help me on this? How can I grouping all the data in a sub group sort by the same date beta into for example 6 groups? Thank you
beta date group
RANK statement will keep the rank for you and remain the original data.
proc rank data=sasdata.Out_reg_betamdi_adj
out = sasdata.Out_reg_betamdi_adj1
groups = 10;
by date;
var beta;
ranks rank_beta;
run;
What result are you trying to achieve given your example dataset?
I have sort the data by date and beta. I want to grouping the betas of the same date into 10 groups (1-10) with equally numbers of observation. so if date 01/01/1980 has 3 obs then I would have 3 groups, each has 1 obs, if date 04/01/1980 has 250 obs then i would have 10 groups each have 25 obs
Can you use proc rank to do what you want? Take a look at: Base SAS(R) 9.2 Procedures Guide
I have try something like this but it did not work.. the value of beta is replaced by the rank. how can I keep the beta and add a column for the rank
proc rank data=sasdata.Out_reg_betamdi_adj
out = sasdata.Out_reg_betamdi_adj1
groups = 10;
by date;
var beta;
run;
RANK statement will keep the rank for you and remain the original data.
proc rank data=sasdata.Out_reg_betamdi_adj
out = sasdata.Out_reg_betamdi_adj1
groups = 10;
by date;
var beta;
ranks rank_beta;
run;
Thank you!
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.