cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

Categorise Columns by initials

SpannerHead
Level V

I'm trying to list available categories of columns based on the first 3 letters of the column title.  I can list all the available values readily but I have many duplicates.  Summarize doesn't obviously work for anything but a list of columns and what I have is a list of initials.  I tried this with no luck.  Any help appreciated.

 

dt = Current Data Table();
dt << Clear Column Selection();

colList = dt << get column names( string );

found_list={};

For( i = 1, i >= N Items( collist ), i++, 

Spud = Char(Munger( Head Name( As Namespace( colList[i] ) ), 0, 3 ));

	If( !Contains(found_list), Spud, insert into(found_list, Spud ))

);

Show(found_list);

Slán



SpannerHead
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User


Re: Categorise Columns by initials

Does this get you any further along

names default to here(1);
dt =
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colList = dt << get column names( string );

for each({col,index}, colList,
	colList[index] = substr(col,1,3)
)

grps = associative array(colList)<<get keys;

It returns all of the unique 3 letter names

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User


Re: Categorise Columns by initials

Does this get you any further along

names default to here(1);
dt =
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colList = dt << get column names( string );

for each({col,index}, colList,
	colList[index] = substr(col,1,3)
)

grps = associative array(colList)<<get keys;

It returns all of the unique 3 letter names

Jim
SpannerHead
Level V


Re: Categorise Columns by initials

Thanks Jim.  There's a ; missing but works well.


Slán



SpannerHead

Recommended Articles