Searching a value in a column- JSLHi All,
Can anyone help me with the search for a particular value in a column and try to find the count of that value with the overall count? In the below example, I am trying to search for value "1" in B column. I found 3 occurences in 10 instances so C is marked with 30%. Similarly for A=2, I found 4 occurence of "1" in 12 instances, so C is marked with 33%.
| A | B | C |
| 1 | 1 | 30% |
| 1 | 87 | |
| 1 | 90 | |
| 1 | 65 | |
| 1 | 1 | |
| 1 | 65 | |
| 1 | 3 | |
| 1 | 1 | |
| 1 | 34 | |
| 1 | 5 | |
| 2 | 1 | 33% |
| 2 | 5 | |
| 2 | 2 | |
| 2 | 47 | |
| 2 | 1 | |
| 2 | 54 | |
| 2 | 1 | |
| 2 | 85 | |
| 2 | 1 | |
| 2 | 1 | |
| 2 | 22 | |
| 2 | 21 | |
Thank you
Re: Searching a value in a column- JSLYou can do virtually anything you want to do in JMP, so yes, there are ways to do what you want. However, the structure you have is a data table, and it's defaults are based upon a column based analysis table structure, not a cell based structure like Excel.
To do what you are asking, I would do the following.
Go to "Column Info" for the percentage column.
In the Column Info window, remove the formula property. This will keep the values, but take away the formula.
Then change the "Data Type" from numeric to character
Close the "Column Info" window
Now go and delete the cell values you don't want.
Re: Searching a value in a column- JSLIs there a way not to duplicate the values? As in, every 1's will be corresponding to the %. If I have multiple 1's in the each 1 will have 30% next to it. Can I make it appear once per Group A just like my example above? Helps me in the plotting and subsequent analysis.Re: Searching a value in a column- JSLyou misspelled "col number()" as "col num()"
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << New Column( "thepercent",
formula( Col Number( :height, :height ) / Col Number( :height ) )
);
Re: Searching a value in a column- JSLHI
I checked the Col Number. Is this what you mean? but it won't work.
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
Col Number( :height,:height )/Col Num( :height )
Re: Searching a value in a column- JSLWow. This is amazing. Thank you txnelsonRe: Searching a value in a column- JSLI think this should work:
col number(:b, :a,
)/col number(:b, :a)
You need to take a look at the documentation on Col Number() in the Scripting Index
Help==>Scripting Index==>Col Number
Re: Searching a value in a column- JSLThank you for the quick solution. Is there a way to segregate by column A. For example, instead of taking all 7 1's and 22 values together, can we do it by column A (10, 12) and getting the corresponding column % statistic?
Thanks.Re: Searching a value in a column- JSL
represents column "b", from the data table you listed in the original question. The formula,
Col Number( :b, :b) / Col Num(
)
is interpreted as:
the count of all of the values in column b, for the current rows value of column b, divided by the total count of the values for column b.
In the example data you provided, the calculation for the first row would be:
The count of values found in column b, that match the value for column b. That is, the value of the first row for column b is "1", so it would count the number of "1"s found in column b, which is 8. It would then divide by the total number of the values found in column b, which is 22.
Concerning the Tabulate Platform, what you would do, is to change the modeling type of column b to Nominal, so Tabulate will treat the column as a grouping column. Then you would drag column b to the Drop Zone for Rows. I will then list out each of the values found for column b. By default, the statistic column that is listed is the count(N). To change it to the Column %, you would just drag the Column % statistic to the "N" column, and it would replace the statistic with the column %

Re: Searching a value in a column- JSLThank you txnelson. What is
represent? I am sorry , still new to this idea. I tried Tabulate also, I don't really understand the syntax which i should use as a grouping column?Re: Searching a value in a column- JSLYou can use the Tabulate Platform and specify the % Column Total as the statistic.
You can also create a new column and use the following formula to get the answer
Col Number( :b, :p</img> ) / Col Number( :p</img> )