Learning SAS? Welcome to the exclusive online community for all SAS learners.

Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Reply
New Contributor
Posts: 3

Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Hi ,

I have a file with data of students with following variables

Name type

Roll_Id num

gender char

Age num

flight char

play char

vote char

HSGPA num

credit num

Height num

i) Now problem is how can I get the students that are ranked top 10% ?

ii) Do comparative analysis of student height by Gender and Play?

SAS Employee
Posts: 3

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Posted in reply to shankarchavan

I did something similar to this. If you could specify what each variable is I can help. For example what is credit num? What is flight char?

Super User
Posts: 11,343

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Posted in reply to shankarchavan

How are the rank to be calculated? Based on a single variable or something using multiple variables? Is "top 10%" going to be the largest or smallest of the ranking?

Occasional Contributor
Posts: 8

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Posted in reply to shankarchavan

Dear Shan,

First, you have to identify which variable(s) that you need to rank and next how you would like to be rank, either it is from small to large or large to small.

You may use the 'By' statement to get it done.

Thanks.

New Contributor
Posts: 3

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Posted in reply to shankarchavan

@jagoma12 : In the above question credit num -->credit(variable) num(type of variable) similarly all other variables are mentioned in the question.

:I think it is based on HSGPA(High school grade point average) variable.

I think it must be ranked from large to small since it is top 10% for HSGPA variable.

Thanks.

SAS Employee
Posts: 3

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Posted in reply to shankarchavan

@shankarchavan If HSGPA is on the 4 point or even 6 point scale it won't help too much. The credit variable may help. If the credits are weighted, for example a regular class is 4 points, honors is 5 points, and AP is 6 points. Then in that case you can do

Proc Sort Data=Dataset Out = Work.Sorted;

By Credit;

Run;

Proc Print Data= Sorted;

run;

New Contributor
Posts: 3

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Thanks jogoma12 but how to get top 10% and do comparative analysis? Will proc anova help in doing  comparative analysis?

SAS Employee
Posts: 3

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Posted in reply to shankarchavan

How many students is it? I don't know about Proc ANOVA so I can not guide you there. However, you can find how many students would be 10%. Then you could run a loop. You can try this one, it should work but no guarantees since it is not debugged. Just change "Original Data Set" to the name of the data set and "TotalNumber of students" to the total in the first two lines of code.

%Let Data= Original Data Set;

%let students = TotalNumber of students;

%let ten= %Eval(&Students*.1);

Data Top_Ten;

Set &Data;

Do i=1 to &ten;

Output;

End;

Run;

Super User
Posts: 10,041

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Posted in reply to shankarchavan

1) proc rank

2) ANOVA  - proc anova  or   proc glm

Xia Keshan

Trusted Advisor
Posts: 1,228

Re: Find the students that are ranked top 10% in their class,do Comparative analysis of student height by gender and play

Posted in reply to shankarchavan

First use proc rank to create 10 groups each containing 10% of the students then use proc anova to test differences among the means for HSGPA taking

HSGPARank as an independent variable.

proc rank data=have out=want descending groups=10 ties=high;

   var HSGPA;

   ranks HSGPARank;

run;

HSGPARank=1 will be the top 10%

Ask a Question
Discussion stats
  • 9 replies
  • 646 views
  • 3 likes
  • 6 in conversation