BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
thdang
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

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;

View solution in original post

6 REPLIES 6
art297
Opal | Level 21

What result are you trying to achieve given your example dataset?

thdang
Calcite | Level 5

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

art297
Opal | Level 21

Can you use proc rank to do what you want?  Take a look at: Base SAS(R) 9.2 Procedures Guide

thdang
Calcite | Level 5

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;

Ksharp
Super User

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;

thdang
Calcite | Level 5

Thank you!

SAS Innovate 2025: Register Now

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!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 1261 views
  • 0 likes
  • 3 in conversation