In the process of daily analysis of data, we often only need a part of the entire data set, such as focusing on only a part of the observations/rows (male or female, patients of a certain age or patients with a certain disease) or a part of the variables/ Columns, etc., can be called subsets of data sets, and the process of splitting the original data is also the process of generating subsets.
So how to select observations that meet the conditions? How to split data into multiple subsets with one click? What are the simple and fast random sampling methods in JMP? Today I will take you to learn an important part of data cleaning.
Figure 1 Main operation page for generating subsets
So how to split it specifically?
What does each option in this dialog box mean?
How to take advantage of these options? Let’s start with the simplest one.
01 If you only need a subset of variables (columns)
For example, in the data set below, only two variables, Y and age, are needed (of course, the actual situation will not be like this. Under normal circumstances, unless there are too many variables, there is no need to separate some variables). You only need to Select the columns you want on the table. Remember to hold down the Ctrl key when there are multiple columns, and then open the subset dialog box, as shown in Figure 2.
Figure 2 Generates new subsets of some columns
This results in a new data set consisting of all observations (rows) and selected variables (columns).
However, more often than not, we want to select observations (rows) that meet specific conditions without any requirements on variables, or select some observations and some variables. Then the following operations of splitting rows can come in handy. .
02 If only a subset of observations (rows) is required
(1) Select rows that meet the conditions
This title is both our purpose and our actions to achieve it. For example, if we want to select observations with age > 40 years old in the data set, we can use [Row] → [Row Selection] → [Select Rows that Meet Conditions], then edit the conditions for filtering observations, click OK, and the observations that meet the conditions in the data will be will be selected.
In this example, 320 rows of observations are selected. If you want to generate these observations into a new subset, you only need to click [Table] → [Subset] without making changes (of course, if you have selected some variables before , then you need to select [Selected Columns] instead of [All Columns]), click OK to generate a new data set from the selected observations, as shown in Figure 3.
Figure 3 Select rows that meet the conditions
Tips : Select observations that meet multiple conditions
Many times we need to select observations that meet ≥2 rules. For example, we want to select women older than 40 years old. The same process is just a little more complicated when editing the rules, see Figure 4. When the relationship between the conditions is "and", select "If all conditions are met"; when it is "or (or)", select "If any condition is met".

Figure 4 Selecting observations that meet multiple conditions
(2) Hide rows that you do not want to analyze
The previous method describes how to generate a new data set from the desired observations so that we can analyze it. Here's how to get the rows we want from another angle, that is, hide the unwanted rows.
The same as the method of selecting rows described above, you can select the rows you want to analyze from [Select rows that meet the conditions], and then reverse the selection to perform the [Hide and exclude] operation, as shown in Figure 5 (the selection has been completed in the figure conditional row).
Tips: It is recommended that you directly select [Hide and Exclude], because only the observations that are [hidden] will also enter the subsequent statistical analysis, but they will not appear when making charts, and the observations that are only [excluded] will not enter the subsequent statistical analysis. in statistical analysis, but will appear when plotting. Generally speaking, for these observations that do not meet the filtering conditions, we neither want them to appear in the chart, nor do we want them to participate in subsequent statistical analysis, so just select [Hide and Exclude].
Figure 5 Hide and exclude rows that you do not want to analyze
Another method is to directly reverse edit the selection conditions, directly filter out the rows that you do not want to include in the analysis, and then click [Hide and Exclude]. Click [Hide and Exclude] again to cancel.
(3) Split into multiple subsets with one click
If for analysis needs, we want to split the data into multiple data sets based on different values of a certain variable, such as splitting into male and female data sets, or splitting into high according to Y (ordered type) in the example data , medium and low three data sets, how simple is this operation in JMP?
We take the latter as an example, see Figure 6. In the variable name list that pops up after checking [Get subset basis], select the basis on which you want to split the data set. In this example, Y (ordered type) is used as the basis. JMP automatically splits the data set into three subsets, respectively. There are three subsets: Y (ordered type) = low, Y (ordered type) = medium and Y (ordered type) = high.
Figure 6 Split subsets according to variable values
Based on variables, JMP will generate a new subset for each value in the variable. For example, if you accidentally use a continuous age variable as the basis for splitting, hundreds of subsets will pop up on your screen, and the observations in each subset have the same age. Be careful with this.
As a special case of splitting the data set, random sampling can actually be regarded as the splitting of the data set, which is equivalent to splitting the randomly selected observations to form a randomly selected sample.
There are many ways to perform random sampling in JMP. The simplest random sampling method is introduced here. We will introduce the specific and more detailed random sampling method in a later article.
This method is still in the [Table] → [Subset] dialog box, as shown in Figure 7. The part in the red box is the key option for random sampling operation. Choose one of the two methods.

Figure 7 Random sampling
As shown in Figure 7, after clicking "OK", you will find that a new data set appears. This is the randomly selected sample data you want. This is probably the simplest random sampling method in history. With this tool, what sampling problems do you need to worry about?
Of course, this kind of random sampling is just simple random sampling. There are also many random sampling methods in practice, such as stratified random sampling, etc. This is also very easy to implement in JMP. We will introduce it in a subsequent article on random sampling. Stay tuned!