Extending PROC RANK to Look for Highest and Lowest “n” Values

Instead of listing the highest and lowest “n” percent of the data values, you might want to select the cutoffs based on the actual number of values, not the percent. This is slightly harder because you have to determine the number of observations in the data set and to compute the percentage cutoffs, given the number of values you want. To save some time (and space) only the macro version of this program is presented. It is followed by the explanation.

Program 2-15. Creating a Macro to List the Top and Bottom “n” Data Values Using PROC RANK
*---------------------------------------------------------------- * | Macro Name: HI_LOW_N | | Purpose: To list N highest and lowest values (approximately) ...

Get Cody’s Data Cleaning Techniques Using SAS® Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.