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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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