BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
steva
Calcite | Level 5

Hi all,

 

So, I'm trying to use the coding for the Top_N Report located at this link:

 

http://support.sas.com/kb/33/009.html

 

These are the tips stated in the comments at the beginning of the program:

 

/*************************************************/

/* TOPNCATEGORIES.SAS */

/* Top N report for data across categories */

/* Use macro variables to customize the data */

/* source. */

/* DATA - SAS library.member for input data */

/* REPORT - column to report on */

/* MEASURE - column to measure for the report */

/* MEASUREFORMAT - specify to preserve measure */

/* format in the report (currency, for example) */

/* STAT - SUM or MEAN */

/* N - The "N" in Top N - how many to show */

 /* CATEGORY - across which category? *

/*************************************************/

 

 

In the example on the SAS Support page,

report = Model (of car)

measure = MPG_City

category = Origin

Producing a Top_N Report of

 

Top Models by MPG_City for each region of Origin.

 

In my data, I have three variables

Location

Happiness

Confidence

 

Which of these are the measure, category and report variables? I am assuming that category = location but what about my other two variables? My variables are independent variables. What I would like is a table ranking the Top 10 scores of Happiness and Confidence by Location.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

How is the code broken? 

What is not working? What code did you actually use - there are 4 programs in that link. 

 

It sounds like you have one category and two measures so you would call it twice, once for each measure. If you want a top 10 based on both you would need a different algorithm. 

You can also try PROC RANK. 

 


@steva wrote:

Hi all,

 

So, I'm trying to use the coding for the Top_N Report located at this link:

 

http://support.sas.com/kb/33/009.html

 

These are the tips stated in the comments at the beginning of the program:

 

/*************************************************/

/* TOPNCATEGORIES.SAS */

/* Top N report for data across categories */

/* Use macro variables to customize the data */

/* source. */

/* DATA - SAS library.member for input data */

/* REPORT - column to report on */

/* MEASURE - column to measure for the report */

/* MEASUREFORMAT - specify to preserve measure */

/* format in the report (currency, for example) */

/* STAT - SUM or MEAN */

/* N - The "N" in Top N - how many to show */

 /* CATEGORY - across which category? *

/*************************************************/

 

 

In the example on the SAS Support page,

report = Model (of car)

measure = MPG_City

category = Origin

Producing a Top_N Report of

 

Top Models by MPG_City for each region of Origin.

 

In my data, I have three variables

Location

Happiness

Confidence

 

Which of these are the measure, category and report variables? I am assuming that category = location but what about my other two variables? My variables are independent variables. What I would like is a table ranking the Top 10 scores of Happiness and Confidence by Location.


 

 

 

View solution in original post

1 REPLY 1
Reeza
Super User

How is the code broken? 

What is not working? What code did you actually use - there are 4 programs in that link. 

 

It sounds like you have one category and two measures so you would call it twice, once for each measure. If you want a top 10 based on both you would need a different algorithm. 

You can also try PROC RANK. 

 


@steva wrote:

Hi all,

 

So, I'm trying to use the coding for the Top_N Report located at this link:

 

http://support.sas.com/kb/33/009.html

 

These are the tips stated in the comments at the beginning of the program:

 

/*************************************************/

/* TOPNCATEGORIES.SAS */

/* Top N report for data across categories */

/* Use macro variables to customize the data */

/* source. */

/* DATA - SAS library.member for input data */

/* REPORT - column to report on */

/* MEASURE - column to measure for the report */

/* MEASUREFORMAT - specify to preserve measure */

/* format in the report (currency, for example) */

/* STAT - SUM or MEAN */

/* N - The "N" in Top N - how many to show */

 /* CATEGORY - across which category? *

/*************************************************/

 

 

In the example on the SAS Support page,

report = Model (of car)

measure = MPG_City

category = Origin

Producing a Top_N Report of

 

Top Models by MPG_City for each region of Origin.

 

In my data, I have three variables

Location

Happiness

Confidence

 

Which of these are the measure, category and report variables? I am assuming that category = location but what about my other two variables? My variables are independent variables. What I would like is a table ranking the Top 10 scores of Happiness and Confidence by Location.


 

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

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
  • 1 reply
  • 1814 views
  • 0 likes
  • 2 in conversation