In the process of daily data analysis, we often only need a part of the entire data set, such as focusing on only a part of observations/rows (male or female, patients of a certain age, or patients with a certain disease) or a part of variables /Columns, etc. These can be called subsets of data sets, and the process of splitting the original data is also the process of generating subsets.
Then how to choose the observation value that meets the conditions? How to split data into multiple subsets with one click? What are the simple and quick random sampling methods in JMP? Today, I will take everyone to learn an important part of data cleaning.
Figure 1 The main operation page for generating a subset
So how do you split it?
What is the meaning of each option in this dialog box?
How to make good use of these options? Let's start with the simplest.
01 If only some variables (columns) are needed
For example, in the data set shown in the figure below, only two variables, Y and age, are needed (of course, this is not the case. In general, unless there are too many variables, you don’t need to pick out some variables separately). Select the column 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 Generate a new subset of some columns
This results in a new data set consisting of all observations (rows) and selected variables (columns).
However, more often, we want to select observations (rows) that meet specific conditions, without requiring variables, or selecting some observations and some variables, then the following operations for splitting rows can come in handy NS.
02 If only a part of observations (rows) are needed
(1) Select the rows that meet the conditions
This title is not only our purpose, but also our operation to achieve it. For example, if we want to select observations in the data set that are older than 40 years old, we can go through [row] → [row selection] → [select eligible rows], and then edit the conditions for filtering observations, click OK, and the observations that meet the conditions in the data Will be selected.
In this example, 320 rows of observations are selected. If you want to generate these observations as a new subset, you only need to click [Table]→[Subset], no change is required (of course, if you have selected it before For some variables, you need to select [Selected Columns] instead of [All Columns]), and click OK to generate a new data set for the selected observations, as shown in Figure 3.
Figure 3 Select eligible rows
Tips : Select observations that meet multiple conditions
In many cases, the observations we need to select must meet ≥2 rules. For example, we need to select women over 40 years old. The same process is just a little more complicated when editing the rules, as shown in Figure 4. When the relationship between the conditions is "and (and)", select [if all conditions are met], and when it is "or (or)", select [if any conditions are met].

Figure 4 Selection of observations that meet multiple conditions
(2) Hide the rows that you don't want to analyze
The previous method introduced how to generate a new data set from the desired observations so that we can analyze it. Here is how to get the rows we want from another angle, which is to hide the unwanted rows.
The same as the method of selecting rows described above, you can select the rows you will 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) Eligible rows).
Tips: It is recommended that you directly select [Hide and Exclude], because the observations that are only [hidden] will also enter the subsequent statistical analysis, but they will not appear when the chart is drawn, but the observations that are only [excluded] will not enter the follow-up In the statistical analysis, but it will appear when drawing. In general, for these observations that do not meet the filter criteria, we neither want them to appear in the chart, nor do we want them to participate in the subsequent statistical analysis, so just select [Hide and Exclude] directly.
Figure 5 Hide and exclude rows that you do not want to analyze
Another method is to directly reverse edit the selection criteria, directly filter out the rows that do not want to be included 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 the different values of a variable, for example, split into two data sets, male and female, or split into high according to Y (ordered type) in the sample data , Medium and low three data sets, how simple is this operation in JMP?
Let's take the latter as an example, see Figure 6. Select the basis of the data set you want to split in the variable name list that pops up after you check [Subset basis]. In this example, based on Y (ordered type), JMP automatically splits the data set into three subsets. They are Y (ordered type) = low, Y (ordered type) = medium and Y (ordered type) = high three subsets.
Figure 6 Split subsets according to variable values
Based on the variable, JMP will generate a new subset of each value in the variable separately. For example, if you accidentally use a continuous age variable as the basis for splitting, then your screen will pop up hundreds of subsets, and the observations of each subset have the same age. Be careful.
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. Here is the simplest random sampling method. We will introduce more detailed random sampling methods in a later article.
This method is still in the dialog box of [Table]→[Subset], 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 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 should I worry about?
Of course, this kind of random sampling is just simple random sampling. In practice, there are many random sampling methods, such as stratified random sampling. This is also very easy to implement in JMP. We will introduce it in the article on random sampling later. Stay tuned!