BookmarkSubscribeRSS Feed
Antaralib
Obsidian | Level 7

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.

6 REPLIES 6
stat_sas
Ammonite | Level 13

Try with proc rank.

 

Antaralib
Obsidian | Level 7

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.

Astounding
PROC Star

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;

Antaralib
Obsidian | Level 7

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

   

Astounding
PROC Star

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.

Antaralib
Obsidian | Level 7

@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).

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

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