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
- :
- how to creat new column if same name column does n...

Topic Options

- 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

May 12, 2014 10:27 AM
(794 views)

hi,

I need to use few columns to do calculation. the question I have is how to create new column and set value of each cell to 0 if same name column does not exist, it there is the column, do nothing. I tried below but it does not work the column already exist. can someone helps me out?

=Data Table**(** "FinalBiningTable" **)** << **Get Column Names()**;

**(**Column_list**)**;

**((**contains**(**Column_list, "N(P, F)"**))**==**0**, Data Table**(** "FinalBiningTable" **)** << **New Column(** "N(P, F)",numeric, ordinal **)**;:Name**(**"N(P, F)"**)** << **Set Each Value(0)**;, empty**())**;

1 ACCEPTED SOLUTION

Accepted Solutions

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

Solution

//dt = data table("FinalBiningTable"); // Uncomment for your table

dt = open**(** "$sample_data\Big Class.jmp" **)**;

column_list = dt << **Get Column Names(**string**)**;

if **(**!contains**(**Column_list, "N(P, F)"**)**,

dt << **New Column(** "N(P, F)",numeric, ordinal, << **Set Each Value(0))**;

**)**;

3 REPLIES

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

//dt = data table("FinalBiningTable"); // Uncomment for your table

dt = open**(** "$sample_data\Big Class.jmp" **)**;

column_list = dt << **Get Column Names(**string**)**;

if **(**!contains**(**Column_list, "N(P, F)"**)**,

dt << **New Column(** "N(P, F)",numeric, ordinal, << **Set Each Value(0))**;

**)**;

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

May 14, 2014 6:46 AM
(642 views)

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

May 14, 2014 6:51 AM
(642 views)

This widget could not be displayed.