- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Wild card for Match function
Hi Everyone,
I had a variable "medium" and l needed a grouping variable so i created another variable for the grouping "EMEM Medium" and below if the code i used to populate the new variable.
Match( :Medium,
"Standard", "Standard",
"Standard 1", "Standard",
"Standard 2", "Standard",
"Standard 3", "Standard",
"Standard 4", "Standard",
"Standard 5", "Standard",
"Standard 6", "Standard",
"Sigma", "Sigma",
"Sigma 1", "Sigma",
"Sigma 2", "Sigma",
"Sigma 3", "Sigma",
"Sigma 4", "Sigma",
"Sigma 5", "Sigma",
"Sigma 6", "Sigma",
"else", -9999)
just wondering if there is wildcard l could have used, or a different approach, to make the syntax a little more compact and readable.
Thanks
Mick
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Wild card for Match function
I think it's not possible with match, see:
But you can uses word in this case, it's much simpler:
Names Default To Here( 1 );
dt = New Table( "test",
New Column( "Medium","Character",
set values(
{"Standard", "Standard 1", "Standard 2", "Standard 3", "Standard 4", "Standard 5", "Standard 6", "Sigma", "Sigma 1", "Sigma 2", "Sigma 3",
"Sigma 4", "Sigma 5", "Sigma 6"}
)
)
);
dt << New Column( "Match", "Character",
formula(
Match( :Medium,
"Standard", "Standard",
"Standard 1", "Standard",
"Standard 2", "Standard",
"Standard 3", "Standard",
"Standard 4", "Standard",
"Standard 5", "Standard",
"Standard 6", "Standard",
"Sigma", "Sigma",
"Sigma 1", "Sigma",
"Sigma 2", "Sigma",
"Sigma 3", "Sigma",
"Sigma 4", "Sigma",
"Sigma 5", "Sigma",
"Sigma 6", "Sigma",
"else", -9999
)
)
);
dt << New Column( "Word", "Character",
formula(
word(1, :Medium)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Wild card for Match function
I think it's not possible with match, see:
But you can uses word in this case, it's much simpler:
Names Default To Here( 1 );
dt = New Table( "test",
New Column( "Medium","Character",
set values(
{"Standard", "Standard 1", "Standard 2", "Standard 3", "Standard 4", "Standard 5", "Standard 6", "Sigma", "Sigma 1", "Sigma 2", "Sigma 3",
"Sigma 4", "Sigma 5", "Sigma 6"}
)
)
);
dt << New Column( "Match", "Character",
formula(
Match( :Medium,
"Standard", "Standard",
"Standard 1", "Standard",
"Standard 2", "Standard",
"Standard 3", "Standard",
"Standard 4", "Standard",
"Standard 5", "Standard",
"Standard 6", "Standard",
"Sigma", "Sigma",
"Sigma 1", "Sigma",
"Sigma 2", "Sigma",
"Sigma 3", "Sigma",
"Sigma 4", "Sigma",
"Sigma 5", "Sigma",
"Sigma 6", "Sigma",
"else", -9999
)
)
);
dt << New Column( "Word", "Character",
formula(
word(1, :Medium)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Wild card for Match function
JMP can also create the Word column shown by @Georg interactively (might need some additional handling for non-matches).
Right click on column header and create new formula column:
or use recode:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Wild card for Match function
Brilliant, thank you Georg, also thank you to jthi, appreciate the replies, thank you both