cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
dharding
Level II

Random row selection below a certain threshold

Hello All,

I am attempting to randomly select 20% of the observations in my table below 200, and then exclude those observations from any analysis. In other words, do a random row selection both at a given percentage and below a certain threshold. Thanks for any pointers!

1 ACCEPTED SOLUTION

Accepted Solutions
XanGregg
Staff

Re: Random row selection below a certain threshold

Two options I can think of.

1. Use Select Where to select rows with values < 200. Make a subset using selected rows and choose Link to Original Table. Make subset of that using a random sample and also choose Link to Original Table. Now select all the rows in the final subset and they will also be selected in the original, because of the linking.

2. Make a new column with a formula such as :value < 200 & random uniform() < 0.2.

View solution in original post

3 REPLIES 3
fugue
Level I

Re: Random row selection below a certain threshold

A simple approach would be to use a data step to get all the obs that satisfy your cutoff value (<200), apply one of the SAS RANDom functions to generate random numbers for each row, sort by the random number and then only keep the top (or bottom) 20%. Then, merge back with your original data to exclude drop those obs.

XanGregg
Staff

Re: Random row selection below a certain threshold

Two options I can think of.

1. Use Select Where to select rows with values < 200. Make a subset using selected rows and choose Link to Original Table. Make subset of that using a random sample and also choose Link to Original Table. Now select all the rows in the final subset and they will also be selected in the original, because of the linking.

2. Make a new column with a formula such as :value < 200 & random uniform() < 0.2.

dharding
Level II

Re: Random row selection below a certain threshold

Thanks Xan,

that works great!

Recommended Articles