Wild card for Match functionHi 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
Data Blending and CleanupRe: Wild card for Match functionBrilliant, thank you Georg, also thank you to jthi, appreciate the replies, thank you both
Re: Wild card for Match functionJMP 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:


Re: Wild card for Match functionI think it's not possible with match, see:
Match (jmp.com)
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)
)
);