Programming the statistical procedures from SAS

How to find top25 values

Reply
Contributor
Posts: 24

How to find top25 values

Hi,

 

E.g I have 3 variables: 

No. of schools in a state

Ranking in state level

year

 

I want to find the no. of schools in the top 25 ranks that have occured more than 3 times.

 

I guess, I need to compare it against year. its easier to match against.

 

Any clue would be helpful.

Trusted Advisor
Posts: 1,222

Re: How to find top25 values

Try with proc rank.

 

Contributor
Posts: 24

Re: How to find top25 values

I tried this:

 

proc sort;
  by group descending amount;
run;

data top3(drop=count);
  set groups;
  by group descending amount;
  if first.group then count=0;
  count+1;
  if count le 3 then output;
run;

proc print;
run;

Also proc rank. Neither worked.

Super User
Posts: 5,246

Re: How to find top25 values

We're both guessing.  Perhaps this is what you want:

 

proc freq data=have order=freq;

tables no_of_schools;

where (1 <= ranking <= 25);

run;

Contributor
Posts: 24

Re: How to find top25 values

Thanks @Astounding.

 

When I run proc freq, it only gives me the name of the students with the frequencies. But does not show me the rank# against those and also I need only the ones that has occurred more than 3 times.

i,e in 2011 - 1

        2016 -2

        2015 - 5 

 

or 2011 - 1

   2013 - 1

  2014 -1.

 

or 2011 - 4

 

could be anything

   

Super User
Posts: 5,246

Re: How to find top25 values

When you first posted the problem, the name of the student wasn't even mentioned as a variable.  If it's important to the result, you will need to illustrate some of the data coming in, and what the report should look like.

Contributor
Posts: 24

Re: How to find top25 values

@Astounding

Sincere apologies. It was name of students and not 'no.'

 

Here's what I am looking for :

 

THe name of the students featured in the top25 ranks of the schools that have occurred more than 3 times (i.e they have come in the top25 ranking for more than 3 times).

Ask a Question
Discussion stats
  • 6 replies
  • 346 views
  • 0 likes
  • 3 in conversation