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.
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.