cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
shasheminassab
Level IV

How to subset top 10 highest values by year and location?

I have a dataset of daily ozone concentrations from multiple sites over several years. Is there a quick way to subset the top ten highest concentrations at each site and year?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to subset top 10 highest values by year and location?

Here is an example of a simple way to create a table with just the top 10 for each group(site)

txnelson_0-1676056755935.png

names default to here(1);

dt=// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << sort(by(:sex, :height), order(descending,descending), replace table(1));

dt<< select where(col cumulative sum(1, :sex) <=10);

dtFinal = dt << subset(output table("Top 10"), selected rows(1), selected columns(0));
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to subset top 10 highest values by year and location?

Here is an example of a simple way to create a table with just the top 10 for each group(site)

txnelson_0-1676056755935.png

names default to here(1);

dt=// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << sort(by(:sex, :height), order(descending,descending), replace table(1));

dt<< select where(col cumulative sum(1, :sex) <=10);

dtFinal = dt << subset(output table("Top 10"), selected rows(1), selected columns(0));
Jim
jthi
Super User

Re: How to subset top 10 highest values by year and location?

You can create formula to get top10, use summary or tabulate. And then depending on how your data looks like you might need additional calculation to easily get the top10

-Jarmo