Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- counting number of cells in a column with a given value

Topic Options

- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

counting number of cells in a column with a given value

Aug 4, 2011 1:46 PM
(1614 views)

Hi,

I'd like to count the number of cells in a column with zero as the value (or another arbitrary number). Ideally, the results would be outputted as a list of counts. Can someone point me in the right direction? Thank you.

Regards,

Will

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

counting number of cells in a column with a given value

I would think that the easiest solution would be to simply use proc freq outputting the results to a file and then post-processing the output file for whatever criteria you need.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

counting number of cells in a column with a given value

If all you want to know is how many times each value occurs in a given column, you could simply use:

Tables menu -> Summary

Enter the column in the field for 'Group'

The resulting table should have 2 columns, the first being all the values that occur, and the second being the number of times each occurs.

-Ben

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

counting number of cells in a column with a given value

Something like this should get you close:

dt << Current Data Table();

cols = dt << Get Selected Columns();

counts = NewTable("Counts for "||char(dt<<Get Name),newColumn("Column"),newColumn("Count"));

for(i = 1, i <= NItems(cols), i++,

r = dt << Select Where( ascolumn(eval(cols*)) == 0 );*

counts << AddRows({:Column = column(dt,cols*)<< Get Name, :Count = NItems(r)});*

);

**I didn't test this.**