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
- :
- Checking loop through a table to check if the column is numeric or nominal

- 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
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 1, 2019 2:41 PM
(723 views)

I have the following table that is the result from __stacking and splitting__ a much larger table. As you can see, X1, 3 and 5 are Numeric and X2, 4 and 6 are Characters. Because this is a results of stacking and splitting, everything is converted to Nominal and Character, is there away to loop through all the columns, check if the value in the 1st row is numeric/continuous and convert the X1, X3 and X5 column back to numeric and continuous?

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

Here is a simple script that will convert the columns found to have numeric values

```
Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << get column names( string, character );
For( i = 1, i <= N Items( colNames ), i++,
If( Is Missing( Num( Column( dt, colNames[i] )[1] ) ) == 0,
Column( dt, colNames[i] ) << data type( numeric ) << modeling type( continuous )
)
);
```

It looks like you need to take the time to read through the Scripting Guide

Help==>Books==>Scripting Guide

Jim

1 REPLY 1

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

Here is a simple script that will convert the columns found to have numeric values

```
Names Default To Here( 1 );
dt = Current Data Table();
colNames = dt << get column names( string, character );
For( i = 1, i <= N Items( colNames ), i++,
If( Is Missing( Num( Column( dt, colNames[i] )[1] ) ) == 0,
Column( dt, colNames[i] ) << data type( numeric ) << modeling type( continuous )
)
);
```

It looks like you need to take the time to read through the Scripting Guide

Help==>Books==>Scripting Guide

Jim