DATA Step, Macro, Functions and more

Present frequencies in a data set, in a certain order.

Reply
N/A
Posts: 0

Present frequencies in a data set, in a certain order.

I have a SAS data set, DataSet1, with among others, a character variable City, that can take 15 different values(city names). I want to find the 5 most frequent cities. The 10 remaining should be counted under the name "Others".

I want the frequencies presented in a new SAS data set, DataSet2, with the two variables City and Number. Number should be in descending order, but 'Others' should always be placed last, like this:

Paris 45
Barcelona 41
Rome 38
Berlin 31
London 28
Others 42

How can that be coded?
Super Contributor
Posts: 292

Re: Present frequencies in a data set, in a certain order.

Posted in reply to deleted_user
If you have SAS/QC, then proc pareto will do this for you.
N/A
Posts: 0

Re: Present frequencies in a data set, in a certain order.

I don't have SAS/QC.
Ask a Question
Discussion stats
  • 2 replies
  • 124 views
  • 0 likes
  • 2 in conversation